Syntax 

Err


Group 

Error Handling 


Description 

Set Err to zero to clear the last error event. Err in an expression returns the last error code. Add vbObjectError to your error number in ActiveX Automation objects. Use Err.Raise or Error to trigger an error event.


Err[.Number]


This is the error code for the last error event. Set it to zero (or use Err.Clear) to clear the last error condition. Use Error or Err.Raise to trigger an error event. This is the default property.


Err.Description


This string is the description of the last error event.


Err.ErrorLine


This string is the error line of the last error event. It is in the same format as text returned by CallersLine.


Err.Source


This string is the error source file name of the last error event.


Err.HelpFile


This string is the help file name of the last error event.


Err.HelpContext


This number is the help context id of the last error event.


Err.Clear


Clear the last error event.

 

Err.Raise [Number:=]errorcode _

       [, [Source:=]source] _

       [, [Description:=]errordesc] _

       [, [HelpFile:=]helpfile] _

       [, [HelpContext:=]context]


Raise an error event.


Err.LastDLLError


Returns the error code for the last DLL call (see Declare).


Example

Sub Main

    On Error GoTo Problem

    Err = 1 ' set to error #1 (handler not triggered)

    Exit Sub

 

    Problem: ' error handler

    Error Err ' halt macro with message

End Sub