Error Function

Description

Returns the error message that corresponds to a given error number.

Syntax

Error[(errornumber)]

The errornumber argument can be any valid error number. If errornumber is not defined, an error occurs. If omitted, the message corresponding to the most recent run-time error is returned. If no run-time error has occurred, Error returns a zero-length string ("").

Remarks

Use the Err function to return the error number for the most recent run-time error.

See Also

Err Function, Error Statement.

Example

This example uses the Error function to print error messages that correspond to the specified error numbers.


For ErrorNumber = 61 To 64    ' Loop through values 61 - 64.
    Debug.Print Error(ErrorNumber)    ' Print error to Debug window.
Next ErrorNumber