The HelpContext property of the Err object defines a help topic within the file
identified by the HelpFile property. Together the two can be used to add additional help to
a message box when an error is displayed to the user. An example of using a help file in
conjunction with an error might look like this:
Dim Msg As String
Err.Number = 61 'Disk Full
Err.Description = "Your disk is full.
Try another drive."
Err.HelpFile = "project1.hlp"
Err.HelpContext = 32 'context ID for a topic within the help file
Msg = Err.Number & "-" & Err.Description & vbCrLf & _
"To see more information, press F1."
MsgBox Msg, , "Error in Project1",
This displays a message box containing the error number, description, and the
option to get help from the help file identified by the HelpFile and HelpContext
properties, as shown in Figure 11.2.
FIGURE 11.2 An error message with a Help option.