I've been using this ultra-helpful forum for awhile, always found answers to my questions. You are the best!
But this time I can't seem to find a solution to what should be a simple case. Tried several suggestions but doesn't seem to work...
So, I'd like to download two reports from another software using the GUI. But sometimes, Report1 or/and Report2 doesn't exist.
Sub Report_download()
On Error Goto RP1_err
'GUI codes to download Report(1)
On Error Goto RP2_err
'GUI codes to download Report(2)
MsgBox "Both Reports downloaded."
Exit Sub
RP1_err:
If MsgBox("Report(1) not found. Proceed to Report(2) download?",
vbYesNo) = vbNo Then Exit Sub
On Error Resume Next
'GUI codes to download Report(2)
If Err.Number > 0 Then
MsgBox "Neither Report(1) nor Report(2) Found"
End If
Exit Sub
RP2_err:
MsgBox "Report(1) downloaded, Report(2) not found. Review manually."
Exit Sub
End Sub
When I run this for a case where neither Report(1) nor Report(2) exist, an error occurs in the "GUI codes to download Report(2)" within RP1_err error handler (as it should), after I press "yes." However, what follows is, instead of showing the message "Neither Report(1) nor Report(2) found," a debugging dialogue box appears. What am I doing wrong?
Appreciate your help!
Resumestatement (On Error Resume Nextdoesn't count). (Technically you can useOn Error Goto -1to clear it, but that's generally a sign of bad design in my experience.GUI codes to download Report(1)andGUI codes to download Report(2)then perhaps I can demonstrate on the use of boolean variables