error 0

U

ubu

What is error 0 and why does it not have a description? Should I trap it in
error handlers?
 
K

Kevin K. Sullivan

0 is the value of Err when there is no error or the Err.Clear has been
executed. I don't suggest that you trap it! ;-)

I'm guessing that you have a procedure that is running into its error
processing section because you don't have an Exit Sub/Function that avoids
the error processing section

E.g. problem code:

Sub Test()
On Error Goto Err_Test

'Normal code here
'
Test_Exit:
'Exit Sub ---- This line commented out will display Error 0 in normal
operation.
Err_Test:
Msgbox "Error " & Err & ": " & Err.Description
Exit Sub
End Sub

Make sure you exit the procedure before you hit the error handler!

HTH,

Kevin
 
U

ubu

thanks.

Kevin K. Sullivan said:
0 is the value of Err when there is no error or the Err.Clear has been
executed. I don't suggest that you trap it! ;-)

I'm guessing that you have a procedure that is running into its error
processing section because you don't have an Exit Sub/Function that avoids
the error processing section

E.g. problem code:

Sub Test()
On Error Goto Err_Test

'Normal code here
'
Test_Exit:
'Exit Sub ---- This line commented out will display Error 0 in normal
operation.
Err_Test:
Msgbox "Error " & Err & ": " & Err.Description
Exit Sub
End Sub

Make sure you exit the procedure before you hit the error handler!

HTH,

Kevin
 

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