Error Checking does nothing

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have put the following code in my vbscript to catch errors, but it does
absolutely nothing. This is straight out of the book.... did I miss
something here?

Thanks

Dim strMessage
If Err.Number <> 0 Then
MsgBox "Well, That didn't Work"
strMessage = "The following error " & Err.Description & _
" has occurred in the " & Err.Source & " appliction. " & _
"The error number was " & Err.Number & ". " & _
"Please report this error to the help desk."

MsgBox strMessage,16,"Run-time Error #" & Err.Number

Exit Sub
End If
 
Can you please provide some context? Your code is fine, except that if there
is no error, code after the "If Err.Number <> 0 Then" line won't run. So if
there are no errors, everything is fine!
 
Back
Top