I wish to clarify  the statement:

 

"    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."

 

As others have also pointed out, "on error goto 0" doesn't do any of those
things; it simply allows normal error processing to again occur for
following commands.  It also prevents you from testing on err.number, which
is cleared; so, you may need to capture err.number before executing the "on
error goto 0".

 

 

Chip

 

 

From: LB [mailto:[email protected]] 
Sent: Monday, November 04, 2013 9:01 AM
To: [email protected]
Subject: Re: Error Handling

 

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,

 

 

 

  _____  


 <http://www.avast.com/> Image removed by sender.

This email is free from viruses and malware because avast! Antivirus
<http://www.avast.com/>  protection is active. 

 

 

  _____  


 <http://www.avast.com/> Image removed by sender.

This email is free from viruses and malware because avast! Antivirus
<http://www.avast.com/>  protection is active. 

 

Reply via email to