Excel shuts down after opening dialog

J

JG Scott

After my vba code (below) displays the SendMail dialog and the email is
sent, Excel displays the message "Excel has encountered a problem and
will shut down". Excel then shuts down and restarts. Does anyone know
why and how to prevent Excel from shutting down?

Thanks.


If MsgBox("Would you like to attach the Sample Report Request to an
email now?", vbYesNo) = vbYes Then
Application.Dialogs(xlDialogSendMail).Show

Else
End If

End Sub
 
T

Tom Ogilvy

This occurs when Excel encounters an error from which it can't recover. the
obvious answer would be to figure out what is causing it to encounter the
error. Does it encounter the error when you perform this action manually?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top