Double error?

Double error?

Anonymous
Not applicable
289 Views
3 Replies
Message 1 of 4

Double error?

Anonymous
Not applicable
I am trying to deal with 2 errors in the same sub (code below). I know I have to reset the error handler but what i am doing is not working. I appreciate any help anyone could give me.

Do Until find1 = True
On Error GoTo quit1
MY CODE HERE.......
Loop
quit1:
find1 = True
Do Until find2 = True
On Error GoTo 0
On Error GoTo quit2
MY CODE HERE.....
Loop
quit2:
find2 = True
0 Likes
290 Views
3 Replies
Replies (3)
Message 2 of 4

Anonymous
Not applicable
What's the error, and what's MY CODE HERE..... look
like?


style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
I
am trying to deal with 2 errors in the same sub (code below). I know I have to
reset the error handler but what i am doing is not working. I appreciate any
help anyone could give me.

Do Until find1 = True
    On Error GoTo quit1

          MY CODE
HERE.......
    Loop
quit1:

    find1 = True
    Do Until
find2 = True
    On Error GoTo 0

    On Error GoTo quit2

         MY CODE HERE.....

    Loop
quit2:
    find2
= True

0 Likes
Message 3 of 4

Anonymous
Not applicable
On Thu, 10 May 2001 14:44:42 -0700, jgamauf
wrote:

»I am trying to deal with 2 errors in the same sub (code below).
»I know I have to reset the error handler but what i am doing is
»not working. I appreciate any help anyone could give me.
»
»Do Until find1 = True
» On Error GoTo quit1
» MY CODE HERE.......
» Loop
»quit1:
» find1 = True
» Do Until find2 = True
» On Error GoTo 0
» On Error GoTo quit2
» MY CODE HERE.....
» Loop
»quit2:
» find2 = True

The approved way:

==========
On Error GoTo ErrHandler1

Do Until find1 = True
MY CODE HERE.......
Loop
quit1:
find1 = True

On Error GoTo ErrHandler2

Do Until find2 = True
MY CODE HERE.....
Loop
quit2:
find2 = True

Exit

ErrHandler1:
Resume quit1
ErrHandler2:
Resume quit2
==========

The unapproved, undocumented, and unsupported way:

==========
On Error GoTo quit1

Do Until find1 = True
MY CODE HERE.......
Loop
quit1:
find1 = True

'reset the error handler
On Error GoTo -1

On Error GoTo quit2

Do Until find2 = True
MY CODE HERE.....
Loop
quit2:
find2 = True
==========

--
Paul Marshall
[email protected]
0 Likes
Message 4 of 4

Anonymous
Not applicable
Paul,

I tried the unapproved, undocumented, and unsupported way and it worked! Thank you. Incidently, is one way better than the other? and why?

Thanks again,
Jamie
0 Likes