9.0

163
[, [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 triggered)
Exit
Sub
Problem: ' error handler
Error
Err ' halt macro with message
End
Sub
Error Instruction/Function
Syntax
Error ErrorCode
-or-
Error[$]([ErrorCode
])
Group
Error Handling
Description
Instruction: Signal error ErrorCode. This triggers error handling just like a real error. The current procedure's error
handler is activated, unless it is already active or there isn't one. In that case the calling procedure
's error handler
is tried. (Use Err
.Raise to provide complete error information.)
Function: The Error( ) function returns the error text string.
Parameter Description
ErrorCode This is the error number.
Example
Sub Main
On Error GoTo Problem
Err
.Raise 1 ' simulate error #1
Exit
Sub
Problem: ' error handler
Debug
.Print "Error$=";Error$
Resume
Next
End
Sub