Microsoft Office 2000/Visual Basic Programmer's Guide   

Displaying Context-Sensitive Help for Command Bar Controls

To implement context-sensitive Help for a command bar control, you set the control's HelpFile property to the name of the Help file that contains the context-sensitive Help topic, and set the HelpContextID property to the context ID of the topic you want to display. There is no need to do this for built-in command bar controls used in custom command bars because they already have context-sensitive Help topics associated with them.

In all Office applications, you can set the HelpFile and HelpContextID properties by using VBA code. In Access, you can also set these properties through the user interface by clicking Customize on the Tools menu. The following code fragment sets these properties for a command bar control:

With ctlCBarControl
   .Caption = "M&y Help"
   .BeginGroup = True
   .FaceId = 0
   .OnAction = "DisplayHelp"
   .HelpFile = strAppPath & "\samplepopups.hlp"
   .HelpContextID = 1004
   .Visible = True
End With