Associating a Help File with Your Application

You can associate a particular HTML Help file with your Excel application in one of two ways: by using the Project Properties dialog box or by writing VBA code.

In the Visual Basic Editor (VBE), choose Tools ^ xxx Properties (where xxx corresponds to your project's name). In the Project Properties dialog box, click the General tab and specify a compiled HTML Help file for the project. This file should have a CHM extension.

It's a good practice to keep your application's Help file in the same directory as the application. The following instruction sets up an association to Myfuncs.chm, which is assumed to be in the same directory as the workbook:

ThisWorkbook.VBProject.HelpFile = ThisWorkbook.Path & "\Myfuncs.chm"

After a Help file is associated with your application, you can call up a particular Help topic in the following situations:

♦ When the user presses F1 while a custom worksheet function is selected in the Insert Function dialog box.

♦ When the user presses F1 while a UserForm is displayed. The Help topic associated with the control that has the focus is displayed.

0 0

Post a comment