Microsoft Office 2000/Visual Basic Programmer's Guide   

Displaying Custom Help Topics in an Office Application's Help Window

Built-in Help in Office 2000 applications is displayed in a docked window on the right side of the application window. If you are displaying a custom Help topic from Excel or PowerPoint by using the Help method of the Application object, you can also display your Help topic in this same window. This isn't possible in Word and Access because they require you to use a call to the HtmlHelp API to display a custom Help topic. Custom Help topics in Word and Access are always displayed in floating windows as defined by the window type specified in the HtmlHelp API call. If you prefer not to display your Excel or PowerPoint solution's Help in a docked window, you can use the HtmlHelp API to display the Help topic as described in "Displaying Help by Using the HtmlHelp API" later in this chapter.

To display a custom Help topic in an Office application's docked Help window, the compiled HTML Help file for your Help project must have a default window definition that is named either MSO_Small or MSO_Large. If you want, you can define toolbar buttons that are different from those in the standard Help window, but changes to other details of the window definition, such as the window's size and placement, will be ignored. The Help topic window will automatically be sized and placed in the application's docked Help window.

In addition to naming the default window definition, the window type's notification ID (referred to as idNotify in the HtmlHelp API) must be set to a nonzero value. This setting is not available in HTML Help Workshop's user interface. In order to make this setting for your Help project, you must edit the Help project file (.hhp) with a text editor and add a nonzero value at the end of your window definition. For example, the default window definition in the Sample.hhp file included in the ODETools\V9\Samples\OPG\Samples\CH13\Help Source subfolder on the Office 2000 Developer CD-ROM looks like this:

[WINDOWS]
MSO_Small="Sample Help","Toc.hhc","Sample.hhk","home.htm",,,,,,0x2121,
200,0x300e,[0,0,445,514],,,,,,,1

The arbitrary value 1 was added to the end of the MSO_Small definition in order to specify a nonzero value for idNotify. After you change this value, make sure that this window definition is also specified as the default window (for example, Default Window=MSO_Small) in the [OPTIONS] section of the .hhp file, and then compile your Help file.

In addition to defining the window type as described above, you must also make sure the Office Assistant is displayed, or your Help topic will not be displayed in the docked Help window. If the Office Assistant isn't displayed, your topic will be displayed with the navigation pane expanded to show the Contents, Answer Wizard, and Index tabs. To make sure the Office Assistant is displayed, the code that displays your topic should set the Visible property of the Assistant object to True before it opens your topic.