Err

Syntax

Err = 0

Error Err

ErrorNum = Err

Remarks

Err is a special variable whose value is the error code for the most recent error condition.

For more information on trapping errors, see On Error.

Example

This macro prompts the user to type a style name that is then applied to the selected paragraphs. The macro contains an error handler that illustrates the use
of Err within a Select Case control structure. The Select Case control structure
in this macro can be described as follows:


Sub MAIN
On Error Goto trap
start:
apply$ = InputBox$("Type a style name:", "Apply Style")
Style apply$
trap:
Select Case Err
    Case 102                'Input box was canceled
    Case 24                'Bad parameter
        MsgBox "No such style; try another name."
        Err = 0
        Goto start
    Case Else            'Any other error condition
        Error Err
End Select
End Sub

See Also

Error, Goto, On Error