David,
    Ignore the last link I gave you MSN took it to it's page.
Use this one below,



Err object:
http://msdn.microsoft.com/en-us/library/sbf5ze0e(v=vs.85).aspx



Sent: Monday, November 04, 2013 9:23 AM
Subject: Re: Error Handling


Hi David,

    got to this link and all the other links:
http://www.microsoft.com/isapi/redir.dll?prd=ie&pver=6&ar=msnhome

    Also the clear method is called when on error resume next is done so you 
need not use it. but, all bets are off when Microsoft says that, but this links 
describes it.

        Bruce

Sent: Monday, November 04, 2013 9:00 AM
Subject: Re: Error Handling


"err.clear" does not change control flow behavior but clears the
properties of the err object, including err.number. "on error goto 0"
changes control flow behavior so that the next error, rather than
setting err properties, will abort code execution.

Beware, by the way, the exact meaning of "on error resume next": It
literally means "on error, resume on the next code line." This has
surprising implications for the following two lines:

if myvar = 1 then

and

do while ii <= n

If myvar doesn't exist, for example, the next line will run as if
myvar were 1. If ii doesn't exist, the loop would never exit. Of
course you can check for err.number inside the If and While loops to
catch this, but it's something not everyone remembers to do. Moral:
Type carefully between "on error resume next" and "on error goto 0"
lines, and at least if you think like I do, keep those sections as
short as possible.

On Mon, Nov 04, 2013 at 02:52:24PM +0100, 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 [1]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,

References

   1. http://librivox.org/podcast.xmlHandling

--
Doug Lee, Senior Accessibility Programmer
SSB BART Group - Accessibility-on-Demand
mailto:[email protected]  http://www.ssbbartgroup.com
"While they were saying among themselves it cannot be done,
it was done." --Helen Keller


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


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

Reply via email to