Err.Clear (method)

Syntax

Err.Clear

Description

Clears the properties of the Err object.

Comments

After this method has been called, the properties of the Err object will have the following values:

 

Property

Value

 

Err.Description

 ""

 

Err.HelpContext

0

 

Err.HelpFile

 ""

 

Err.LastDLLError

0

 

Err.Number

0

 

Err.Source

""

 

The properties of the Err object are automatically reset when any of the following statements are executed:

Resume Exit Function

On Error Exit Sub

Example

'The following script gets input from the user using error

'checking.

Sub Main()

  Dim x As Integer

  On Error Resume Next

  x = InputBox("Type in a number")

  If Err.Number <> 0 Then

  Err.Clear

  x = 0

  End If

  MsgBox x

End Sub

See Also

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

More information

E