Err.Description (property)

Syntax

Err.Description [= stringexpression]

Description

Sets or retrieves the description of the error.

Comments

For errors generated by BasicScript, the Err.Description property is automatically set.

For user-defined errors, you should set this property to be a description of your error. If you set the Err.Number property to one of BasicScript’s internal error numbers and you don’t set the Err.Description property, then the Err.Description property is automatically set when the error is generated (i.e., with Err.Raise).

Example

'The following script gets input from the user using error

'checking. When an error occurs, the Err.Description property

'is displayed to the user and execution continues with a default

'value.

Sub Main()

  Dim x As Integer

  On Error Resume Next

  x = InputBox("Type in a number")

  If Err.Number <> 0 Then

  MsgBox "The following error occurred: " & Err.Description

  x = 0

  End If

  MsgBox x

End Sub

See Also

Error Handling (topic), Err.Clear (method), Err.HelpContext (property), Err.HelpFile (property), Err.LastDLLError (property), Err.Number (property), Err.Source (property)

More information

E