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.

Parameters

Parameters Description
ErrorCode This is the error number.

Example


Sub Main
    On Error GoTo Problem
    Error 1 ' simulate error #1
    Exit Sub
 
Problem: ' error handler
    Debug.Print "Err.Description="; Err.Description
    Resume Next
End Sub