Simple Error hadling
Simple Error hadling
(OP)
I have a simple Sub with an Error Handler:
The program generates a few errors, but only first one goes to the ErrorHandler, the rest just display the message in VBA IDE about the error.
I don't have anywhere On Error GoTo 0 or anything.
I did try all setting options in Tools - Options... - General tab - Error Trapping frame
How do I trap all errors, not just the first one?
CODE
Private Sub Test()
On Error GoTo ErrorHandler
...
Exit Sub
ErrorHandler:
'Deal with the error
End Sub
The program generates a few errors, but only first one goes to the ErrorHandler, the rest just display the message in VBA IDE about the error.
I don't have anywhere On Error GoTo 0 or anything.
I did try all setting options in Tools - Options... - General tab - Error Trapping frame
How do I trap all errors, not just the first one?

---- Andy
"Hmm...they have the internet on computers now"--Homer Simpson
RE: Simple Error hadling
Resume
CODE
Skip,
Just traded in my OLD subtlety...
for a NUance!
"The most incomprehensible thing about the universe is that it is comprehensible" A. Einstein
RE: Simple Error hadling
combo
RE: Simple Error hadling
CODE
That's why Resume or Resume Next would not work because I don't want to re-execute the line of code that created the error, or execute next line of code. I want to 'jump' (GoTo) somewhere else in the code.
---- Andy
"Hmm...they have the internet on computers now"--Homer Simpson
RE: Simple Error hadling
GoTo ThePlaceResume ThePlacecombo
RE: Simple Error hadling
I always used Resume or Resume Next, but never Resume [label] and I didn't even know about it.
---- Andy
"Hmm...they have the internet on computers now"--Homer Simpson
RE: Simple Error hadling
combo
RE: Simple Error hadling
CODE --> VB
Private Sub Test() On Error GoTo ErrorHandler ... ThePlace: ... On Error GoTo 0 'This allows errors to be handled 'up the stack' Exit Sub ErrorHandler: 'Deal with the error Resume ThePlace End Sub