I have an Add-In with several user-defined functions. The documentation
is in a chm help file located in the same directory. To set the
function options and define the context sensitive help tags I have the
following code for each function:
Application.MacroOptions Macro:="Air_visc", _
Description:="Viscosity of Air, lbm/(in*s)." & Chr(10) & "T -
Temperature, R", _
HelpContextID:=1010, HelpFile:=ThisWorkbook.Path &
"\EngFunctHelp.chm"
These commands for each function are in a subroutine. The subroutine is
only run once when creating the final version of the Add-in file. The
context sensitive help opens from the formula pallete in a single paned
window - without the index, search, and table of contents tabs. I don't
think this behavior can be changed. For context senstive help this is
fine with me since it shows the user only the information for the
function they are currently trying to use in a simple window interface.
I also provide a menu item in the Help menu for user to access the full
help file - with the index, search, and table of contents tabs. The
following code is used to open the file:
Sub ShowEngFunctHelp()
' Show help using API function (Using Application.Help does not work
correctly)
Dim Result
Result = HtmlHelp(0, ThisWorkbook.Path & "\EngFunctHelp.chm", &HF,
ByVal 1000)
If Result = 0 Then MsgBox "Cannot display Help", vbCritical,
"Eng-Funct Help"
End Sub
"1000" is the contextID for the first page of the help file containing
the name, logo, etc for the Add-in.
Hope this helps,
Dave Parker