Microsoft Office 2000/Visual Basic Programmer's Guide   

Displaying Help for Properties and Methods in Class Modules

You can also add Help information for the custom properties and methods in your class modules. If you do so, Help can be displayed for these properties and methods by pressing F1 when they are viewed in the Object Browser or used in a procedure. This feature is useful if you will be distributing your applications to other developers.

To provide Help for properties and methods in a class module

  1. Create a Help file that contains the topics you want to display and maps each topic to a numeric context ID. For more information about creating a Help file, see "Creating a Help File to Use with an Office Solution" earlier in this chapter.

  2. Open the Visual Basic Editor in the application you are working with.

  3. In the Project Explorer, right-click the name of the VBA project for the document you are working with, and then click projectname Properties.

  4. In the Help File Name box, specify the name of the Help file that contains the Help topics. If you don't include the full path, Help will be displayed as long as the Help file is installed in the same folder as your solution.

    Note   You can specify only one Help file per VBA project. If you want to define context-sensitive Help for more than one class module or for UserForms in the project, the Help file you specify must contain topics for all of these items.

  5. Open the Object Browser, and then click the name of your class module in the Classes box.

  6. In the Members Of box, right-click a property or method, and then click Properties.

  7. In the Member Options dialog box, type the context ID of the topic to display in the Help Context ID box. You can also type a description that will display in the Object Browser in the Description box.

  8. Repeat steps 6 and 7 for each property and method in your class module.

The WordHelp.doc file in the ODETools\V9\Samples\OPG\Samples\CH13 subfolder on the Office 2000 Developer CD-ROM contains a class module (clsTimerClass) that has Help topics associated with its properties and methods. In addition, the modTimerHelp module demonstrates how to display these Help topics from a procedure.