"End" Button for Error Messages

S

Steph

Is there a way in VBA to display a message box that shows the just the
following:

-- Error Code
-- Error Message
-- An "End" button

I want to use an "End" button to force an immediate stop to the application.
I've experimented with the "OK" button and error trapping but, due to the
way my application is built, the code seems to continue to loop even after an
error is trapped.

Thank you for your help.
 
P

papou

Hello Steph

There is no such End button in common Excel message boxes. You could use a
userform though.
But since your are having trouble in ending the sub when an error occurs,
envisage using the End instruction, eg:
On Error Goto ErrTrap
'......
Exit Sub

ErrTrap:
Msgbox "Error number " & Err.Number & " " & Err.Description
End
End Sub

HTH
Cordially
Pascal
 

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