Error Event

Applies To

CheckBox control, ComboBox control, CommandButton control, Frame control, Image control, Label control, ListBox control, MultiPage control, OptionButton control, ScrollBar control, SpinButton control, TabStrip control, TextBox control, ToggleButton control, UserForm object.

Description

Occurs when a control detects an error and cannot return the error information to a calling program.

Syntax

For MultiPage

Private Sub object_Error( index As Long, ByVal Number As Integer, ByVal
úDescription As MSForms.ReturnString, ByVal SCode As SCode, ByVal
úSource As String, ByVal HelpFile As String, ByVal HelpContext As Long,
úByVal CancelDisplay As MSForms.ReturnBoolean)

For other controls

Private Sub object_Error( ByVal Number As Integer, ByVal Description As úMSForms.ReturnString, ByVal SCode As SCode, ByVal Source As String,
úByVal HelpFile As String, ByVal HelpContext As Long, ByVal CancelDisplay
úAs MSForms.ReturnBoolean)

The Error event syntax has these parts:

Part

Description

object

Required. A valid object name.

index

Required. The index of the page in a MultiPage associated with this event.

Number

Required. Specifies a unique value that the control uses to identify the error.

Description

Required. A textual description of the error.

SCode

Required. Specifies the OLE status code for the error. The low-order 16 bits specify a value that is identical to the Number argument.

Source

Required. The string that identifies the control that initiated the event.

HelpFile

Required. Specifies a fully qualified path name for the Help file that describes the error.

HelpContext

Required. Specifies the context ID of the Help file topic that contains a description of the error.

CancelDisplay

Required. Specifies whether to display the error string in a message box.


Remarks

The code written for the Error event determines how the control responds to the error condition.

The ability to handle error conditions varies from one application to another. The Error event is initiated when an error occurs that the application is not equipped to handle.