G
Guest
Following is the code used to attach an Excel file to an Outlook message.
Occassionally, users will click "NO" when they get the outlook message. I
would like to put them in a loop that forces them to click "YES"
This code works well the first time. When they click "NO" it throws the
code to the error handler. Then the macro tries to re-send the attachment a
second time. If you click "NO" a second time, it doesn't go to the error
handler but instead produces a run time error. The run-time error is as
follows: General Mail Failure. Quit Microsoft Office Excel, re-start the
mail system and try again.
' the code does stuff
DoMore:
On Error GoTo errmsg
ActiveWorkbook.SendMail Recipients:="(email address)", Subject:=FileName
ActiveWorkbook.Close (True)
msgbox "Your file has been sent for processing"
' the code does more stuff
Exit Sub
errmsg:
msgbox "You have clicked the NO button. You must click YES to send your
file."
Err.Clear
GoTo DoMore
Any suggestions or ideas on changing the code would be appreaciated. Thanks
for all of the help with this issue.
Occassionally, users will click "NO" when they get the outlook message. I
would like to put them in a loop that forces them to click "YES"
This code works well the first time. When they click "NO" it throws the
code to the error handler. Then the macro tries to re-send the attachment a
second time. If you click "NO" a second time, it doesn't go to the error
handler but instead produces a run time error. The run-time error is as
follows: General Mail Failure. Quit Microsoft Office Excel, re-start the
mail system and try again.
' the code does stuff
DoMore:
On Error GoTo errmsg
ActiveWorkbook.SendMail Recipients:="(email address)", Subject:=FileName
ActiveWorkbook.Close (True)
msgbox "Your file has been sent for processing"
' the code does more stuff
Exit Sub
errmsg:
msgbox "You have clicked the NO button. You must click YES to send your
file."
Err.Clear
GoTo DoMore
Any suggestions or ideas on changing the code would be appreaciated. Thanks
for all of the help with this issue.