It is true that "on error resume next" is canceled by the end of a
sub or function.  My concern was to make sure that people did not
simply forget to end those blocks.  For years, I have seen VBScript
(and probably straight VB) code samples that began with "on error
resume next" as a matter of course.  I expect that a number of
VBScript authors might therefore type that line more or less
automatically, so I decided to make a loud enough noise to change
that. <grin>

So in other words, don't take my "infinite" score as a condemnation,
but rather, just as the "Heads up!" it was intended to be.

On Fri, Sep 12, 2008 at 07:34:25AM -0400, Ron Parker wrote:
Jamal Mazrui wrote:
>Regarding the "On Error Resume Next" statement, I think a closing "On
>Error GoTo 0" is not actually needed if if the statement is intended to
>apply to the remainder of a Function or Sub.  


That's true.  This is from the MSDN documentation for VBScript:

An *On Error Resume Next *statement becomes inactive when another 
procedure is called, so you should execute an *On Error Resume Next* 
statement in each called routine if you want inline error handling 
within that routine. When a procedure is exited, the error-handling 
capability reverts to whatever error-handling was in place before 
entering the exited procedure.



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

Reply via email to