Can't Raise Error twice

D

DzednConfsd

What am I doing wrong? The second time the sub CallMe is called, I get
the VB Runtime error instead of the error passing back to the calling
procedure and being dealt with there.
Thanks for your help.
Sub test()
Dim x As Integer
On Error GoTo test_Error

NEXTACCOUNT:

For x = 1 To 10
callme
Next

Exit Sub
test_Error:
MsgBox "Error " & Err.Number & " (" & Err.Description & ") in
procedure test of Module Module1"
Err.Clear
GoTo NEXTACCOUNT
End Sub

Sub callme()
Err.Raise 2500, "callme", "Testing"
End Sub
 
C

Chip Pearson

You need to RESUME NEXTACCOUNT rather than GOTO NEXTACCOUNT.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top