Hi Chip,
I know and corrected myself and posted the actual doc on the On Error
routines.
The price to pay when you read the first dated and not the last, but the
data is there for all, especially the one I sent with 2 links with the text
beneath it...instead of going to the web page.
The other mistake I mentioned is the assign to 0 and that is actually done
using the resume next itself along with the clear statement and examples are
there.
Bruce
Sent: Tuesday, November 05, 2013 7:19 AM
Subject: RE: Error Handling
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,
----------------------------------------------------------------------------
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.
---
This email is free from viruses and malware because avast! Antivirus protection
is active.
http://www.avast.com