David,
Also, clear the error after you have had the if statement show it is not 0.
The on error goto 0 statement actually displays the error and shuts down
the app and places you into the error mode message and giving the description
of the error.
Of course you can capture that description if you wish using the
Err.Description method and place it inside something like a msgbox.
Bruce
Sent: Monday,
November 04, 2013 8:56 AM
Subject: Re: Error Handling
David,
Use the first one, 1: Err.Clear
Always null out or set Err.Number = 0 also.
Bruce
Sent: Monday, November 04, 2013 8:52 AM
Subject: Error Handling
Scripters,
I am a bit confused.
I have tried to search the net for different methods of error handling in
VBS, and found that there seem to be some kind of confusion going on. Smile. At
least, I can't make head and tail to a certain point here.
I have an Error http://librivox.org/podcast.xmlHandling code like this:
On Error Resume Next
'Perform an action
If Err.Number <>0 Then
'Do something
Else
' Do something else.
End If 'Err.Number <>0.
OK, this code seems to work pretty fine, at least as long as I only perform
an error check one place in my code. Yet, if I have a similar code further down
the app, it seems as the error resuming does not stop. So, I searched the net.
And I found two instructions, that confuses me:
1: Err.Clear
and,
2: On Error Goto 0.
Can anyone tell me which of them, I should use in my code, so as to reset
the error resuming for each time i have checked for an error? What is the
correct place to put any of these instructions? Should I put them before,
after, or even somewhere inside the Error checking routine?
Hope all of this made any sense, and that someone please would be kind to
enlighten me.
Thanks,
------------------------------------------------------------------------------
This email is free from viruses and malware because avast! Antivirus
protection is active.
---
This email is free from viruses and malware because avast! Antivirus protection
is active.
http://www.avast.com