Are you using any error handling code? Like "On Error GoTo ErrDBConnection" and stuff like that?
Because imho, that is the way you should be handling this...
Also, if you get an error a few methods deep... I think it's strange to want to skip any further handling in parent methods...
You need a way for the error to 'bubble up' to where you want to handle it. And when you handle it, all parent methods of that location should be able to continue their work, otherwise that error was not really handled.
Basically, the simplest way to achieve what you want, would be like this:
- add a catch-all errorhandler in your userform event handlers (for click handlers etcetera) where you call the next level of code.
- don't use any error handler in the lower levels of code.
- if any error pops up at any depth level , it bubbles up right to the handler in the userform event, where you can show the messagebox and leave it at that.
It might look like this:
Code:
Public Sub btnSomeOperation_Click()
On Error GoTo ErrUnexpected
Call TheNextLevel
ExitSub:
Exit Sub
ErrUnexpected:
MsgBox "Something unexpected happened, sorry, please try again...", vbOKOnly + vbExclamation
Resume ExitSub
End Sub