Also, there is no need to explicitly check Err.Number unless you want to retrieve the actual error number. Number is the default property of the Err object. It is a boolean value; 0 is false, therefore anything else is true because it will be the error number. So all you have to do is the following.

If Err then
    'Code to handle the error and clear Err.
End If

Use On Error GoTo 0 at whatever point you want to disable error checking.

Hth,
Tom


On 11/4/2013 9:00 AM, Aaron Smith wrote:
Hi, David.

You'll want to use On Error Goto 0 to disable your error handling so
that it doesn't continue for the rest of your code. For example:

' begin error handling
On Error Resume Next
' do something
' end error handling
On Error Goto 0

Err.Clear simply resets the current error number.

Aaron

On 11/4/2013 8:52 AM, David wrote:
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,

--
Aaron Smith
Web Development * App Development * Product Support Specialist
GW Micro, Inc. * 725 Airport North Office Park, Fort Wayne, IN 46825
260-489-3671 * gwmicro.com

To insure that you receive proper support, please include all past
correspondence (where applicable), and any relevant information
pertinent to your situation when submitting a problem report to the GW
Micro Technical Support Team.


Reply via email to