Using the Help method

Use the Help method of the Application object to display a Help file —either a WinHelp HLP file or an HTML Help CHM file. This method works even if the Help file doesn't have any context IDs defined.

The syntax for the Help method is as follows:

Application.Help(helpFile, helpContextID)

Both arguments are optional. If the name of the Help file is omitted, Excel's Help file is displayed. If the context ID argument is omitted, the specified Help file is displayed with the default topic.

The following example displays the default topic of Myapp.chm, which is assumed to be in the same directory as the workbook that it's called from. Note that the second argument is omitted.

Sub ShowHelpContents()

Application.Help ThisWorkbook.Path & "\Myapp.chm" End Sub

The following instruction displays the Help topic with a context ID of 1002 from an HTML Help file named Myapp.chm:

Application.Help ThisWorkbook.Path & "\Myapp.chm", 1002

0 0

Post a comment