You are here: Tips and Techniques for Word > Using WinHelp Macros in Word > Sample WinHelp Macro Uses > Adding a Button with Topic Macros

Adding a Button with Topic Macros

You can create Windows Help macros that start whenever the user enters a certain topic. This is useful for customizing topics with buttons, menu items, and markers. The procedure below uses "nested" macros. In this example, you will provide a button that takes the user to a URL you have defined.

1.   Open your Help project.

2.   Select the Topics icon.

3.   Select the topic you want to use from the right pane.

4.   From the property pane, click the WinHelpMacro property. The Edit Windows Help Macro dialog opens.

5.   From the drop-down list box in the Macro executed from topic area, select CreateButton.

6.   Select the button-id box and type btn_url in the textbox at the top of the CreateButton Arguments area. This is the name you use to identify the button. It can be any unique identifier.

7.   Select the name box and type Related &Link in the textbox at the top of the CreateButton Arguments area. This is the text that you want to appear on the button. The character following the ampersand is the hotkey.

8.   Select the button-macro cell and click the ellipsis button as shown below.

A second Help Macro dialog box appears. You specify here which macro you want executed when the user clicks on the Related Link button. In this example, when the button is clicked, a browser open with the ComponentOne website.

9.   From the drop-down list box, select ExecFile. The ExecFile Arguments section appears in the dialog box.

10.  Select the program box and type http://www.componentone.com in the textbox at the top of the ExecFile Arguments area.

11.  Select the display-state box, and from the drop-down at the top, select the value, 5 – SW_SHOW. Your dialog should look like the example below.

12.  Click OK to return to the first dialog box.

13.  Click OK.

14.  Build your WinHelp file.

15.  Open your WinHelp file, go to the topic you used for your button, and test the button.