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 start 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 start an error event. This is the default property.
Err.Description
This string is the description of the last error event.
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
For 32 bit windows this returns the error code for the last DLL call (see Declare). For 16 bit windows this always returns 0.
Example:
Sub Main
On Error GoTo Problem
Err = 1 ' set to error #1 (handler not started)
Exit Sub
Problem: ' error handler
Error Err ' halt macro with message
End Sub