How to Run a WinHelp Macro from a Help File
ID: Q104165
|
The information in this article applies to:
-
Microsoft Visual Basic Standard and Professional Editions for Windows, versions 1.0, 2.0, 3.0
SUMMARY
This article shows by example how to invoke WinHelp macros in a Help file
upon first entering a topic or upon clicking a hot spot. The examples show
you how to modify the example help topic source file VB\HC\ICONWRKS.RTF
using Microsoft Word version 2.0 for Windows. After making the changes and
compiling the .RTF file into a Help file (.HLP file), you will be able to
execute a macro upon first entering the topic or upon clicking a hot spot.
MORE INFORMATION
To run a macro when a topic is first entered, enter the macro call into
a custom footnote with an exclamation (!) as the footnote mark. To do
this in Microsoft Word version 2.0 for Windows, follow these steps:
- Open the file VB\HC\ICONWRKS.RTF.
- Locate the beginning of this topic heading:
Editor: Commands and Tools
Place the text caret at the beginning of the line, in front of the pound
(#) character.
- From the Insert menu, choose Footnote and select Custom Footnote Mark.
Enter the exclamation mark (!) and choose the OK button. The Footnotes
area appears at the bottom of the window with the caret on a line that
begins with the exclamation mark (!).
- Enter this text:
About()
- To save this change, from the File menu, choose Close. In each of the
subsequent three dialogs, press the Enter key to select the default
button.
- At the command prompt, set the current directory to VB\HC. Then enter
the following command to compile the help file:
HC31 ICONWRKS.HPJ
- Load the resulting ICONWRKS.HLP file into WINHELP.EXE. To do this in the
Program Manager, from the File menu, choose Run. Then enter the full
path of VB\HC\ICONWRKS.HLP. The IconWorks help file appears.
- Click the hot spot Commands and Tools to jump to the topic that contains
the macro call. When the topic appears, the About() macro displays a
dialog box titled About Help.
To run a macro immediately when a hot spot is clicked, format the hot spot
text as double-underlined text followed by an exclamation mark (!) and the
macro call -- both formatted as hidden text. To do this in Microsoft Word
version 2.0 for Windows, follow these steps:
- Open the file VB\HC\ICONWRKS.RTF.
- From the Tools menu, choose Options. Select the View Category. In the
section labeled Nonprinting Characters, check Paragraph Marks and
Hidden Text.
- Place the text caret at the beginning of the second line of the file
(the line following the heading). Enter the text "Call Macro!About()"
without the quotation marks, and press the Enter key.
- Select the text "Call Macro" up to but not including the exclamation
mark. From the Format menu, choose Character. Change the setting in the
combo box labeled Underline from None to Double. Choose the OK button.
- Select the text "!About()" up to but not including the paragraph
character at the end of the line. From the Format menu, choose
Character. In the Style section, check Hidden.
- Close the file. Compile it using the Help compiler (HC31.EXE). Then view
the compiled .HLP file using WINHELP.EXE. See the previous example for
an explanation of how to do this.
- Click the Call Macro hot spot. The About() macro displays a dialog box
titled About Help.
Additional query words:
3.00
Keywords :
Version :
Platform :
Issue type :
Last Reviewed: June 25, 1999