On error goto ... / on error resume next

raindrop3

Registered User.
Local time
Today, 14:03
Joined
Sep 6, 2001
Messages
98
Hello,

(I searched the forums, but didn't find what i was looking for)

I have a question about error handling. If I -in the top of my module- write 'on error goto errhandling' and in the middle -in a WITH-statement' I write 'On error resume next' , why is the first error handling working and not the second (on error resume next)? In the first part of my code, i had to check if a user did something wrong, but in the 'with' statement I want the code just keep firing.


Short:
Is that possible to use 'On error goto errhandling' and 'On error resume next' in the same module / code?

Thanks.

Albert
 
Short answer .. never tried it but suspect not.
You could trap specific error numbers in your error handler like ...
on error goto err_hand

err_hand:
' Error 3376 is something that might
' occur in the With loop that you want it to ignore
if err.number = 3376 then resume next
 
Another approach is simply to use additional On Error statements to change the error handling at each point you need to do so. What I mean is, use separate On Error statements, rather than trying to incorporate them into With statements.
 

Users who are viewing this thread

Back
Top Bottom