Partager via


HelpContext Property

Sets or returns a context ID for a topic in a Help File.

                      object
                      .HelpContext [= contextID]

Arguments

  • object
    Required. Always the Err object.

  • contextID
    Optional. A valid identifier for a Help topic within the Help file.

Remarks

If a Help file is specified in HelpFile, the HelpContext property is used to automatically display the Help topic identified. If both HelpFile and HelpContext are empty, the value of the Number property is checked. If it corresponds to a VBScript run-time error value, then the VBScript Help context ID for the error is used. If the Number property doesn't correspond to a VBScript error, the contents screen for the VBScript Help file is displayed.

The following example illustrates use of the HelpContext property:

On Error Resume Next
Dim Msg
Err.Clear
Err.Raise 6   ' Generate "Overflow" error.
Err.Helpfile = "yourHelp.hlp"
Err.HelpContext = yourContextID
If Err.Number <> 0 Then
   Msg = "Press F1 or Help to see " & Err.Helpfile & " topic for" & _
   " the following HelpContext: " & Err.HelpContext
   MsgBox Msg, , "error: " & Err.Description, Err.Helpfile, Err.HelpContext
End If

Requirements

Version 2

Applies To: Err Object (VBScript)

See Also

Reference

Description Property (VBScript)

HelpFile Property (VBScript)

Number Property (VBScript)

Source Property (VBScript)