Professional Documents
Culture Documents
Example application
A zipped archive containing a simple Excel VBA application is available from
http://indigoware.com/developers which demonstrates all the techniques
described in this paper. It was produced using Microsoft Excel 2003 together
with Help Publisher for FrontPage version 2.2.
Creating and editing the Help file with Help Publisher for FrontPage
To edit the Help file using Help Publisher for FrontPage:
1. Create a new FrontPage web site to contain the Help file topics.
2. Enable Help Publisher in this web site by selecting 'Enable Help Publisher
in Web Site' from the 'Help Publisher' menu in FrontPage.
3. Create and edit the Help topic pages just as if you are editing a normal
FrontPage web site.
4. Select ‘Project Options’ from the ‘Help Publisher menu. In the ‘Compiled
HTML Help Filename’ field on the ‘General’ tab, set the filename and
location of the compiled Help file. A good location is within the same
directory as the Excel workbook that contains the VBA code.
5. To compile the web site into a compiled HTML Help file select ‘Compile
HTML Help File’ from the ‘Help Publisher’ menu.
If you have an existing Help file you can import it into Help Publisher for
FrontPage using the Import wizard. See Help Publisher’s own Help file for
further information.
Help Context Ids can be assigned to Help topic pages using the ‘Help Context
Ids’ view of the Context Ids Editor. Alternatively they can be set from a Help
topic page’s Page Options dialog (select 'Page Options' from the 'Help Publisher'
menu) by clicking 'Add' in the Context Id section. The Help Context Id names
can either be a number or the name of a constant.
Help Publisher for FrontPage can generate a Visual Basic module file containing
all the Help Context Ids assigned in the Help file.
To enable this option:
1. Select 'Context Ids Editor' from the 'Help Publisher' menu.
2. Select the 'Export File' view.
3. Set the 'Development Language' field to 'Visual Basic 6.0'.
4. In the 'Generated Module Filename' field, enter the desired filename for
the generated VB6 module.
5. Recompile the Help project using Help Publisher for FrontPage.
6. Import the generated Visual Basic module to your Excel VBA project.
Note that it is necessary to re-import the Visual Basic module into your Excel
VBA project in order to pick up any changes to the module file made by Help
Publisher for FrontPage.
If ContextID = 0 Then
Application.Help ThisWorkbook.Path & "\HelpFile.chm"
Else
Application.Help ThisWorkbook.Path & "\HelpFile.chm", ContextID
End If
End Sub
Then add the following Help button Click event handler to the UserForm
(assumes the relevant Help topic is associated with Help Context Id 1010):
Run your Excel VBA application and you will now find that when the Help button
is pressed the relevant Help file topic is displayed.
See the example application and Excel’s own Help topic on the
Application.MacroOptions method for further details.
' Display a message box with a help button linked to a help topic
MsgBox "Press the help button for further details.", _
Buttons:=vbOKOnly Or vbMsgBoxHelpButton, _
HelpFile:=ThisWorkbook.Path & "\HelpFile.chm", _
Context:=1012
Conclusion
Excel VBA provides the basic functionality necessary to support context-sensitive
Help. By following the techniques described in this paper, the information
contained in the Help file can be made available to the user in a more accessible
form.
The combination of using Indigoware’s Help Publisher for FrontPage with Excel
VBA can make the task of producing professional Help files that support context-
sensitive Help much easier.
If you are not already familiar with how to use Help Publisher for FrontPage to
edit the Help file’s contents and index, or how to add ‘See Also’ menus, now is a
good time to take the tutorial supplied with Help Publisher for FrontPage.
Free Trial
For a free trial version of Help Publisher for FrontPage visit:
http://indigoware.com/download.
Microsoft, Excel, Visual Basic and FrontPage are either registered trademarks or trademarks of
Microsoft Corporation in the United States and/or other countries.