Addressing a Help File
To invoke them, use some code like
Declare Function HtmlHelp Lib "hhctrl.ocx" _
Alias "HtmlHelpA" _
(ByVal hWnd As Long, _
ByVal lpHelpFile As String, _
ByVal wCommand As Long, _
ByVal dwData As Long) As Long
Const HH_DISPLAY_TOPIC = &H0
Const HH_SET_WIN_TYPE = &H4
Const HH_GET_WIN_TYPE = &H5
Const HH_GET_WIN_HANDLE = &H6
Const HH_DISPLAY_TEXT_POPUP = &HE ' Display string resource ID or text in
a pop-up window.
Const HH_HELP_CONTEXT = &HF ' Display mapped numeric value in
dwData.
Const HH_TP_HELP_CONTEXTMENU = &H10 ' Text pop-up help, similar to WinHelp's
HELP_CONTEXTMENU.
Const HH_TP_HELP_WM_HELP = &H11 ' text pop-up help, similar to WinHelp's
HELP_WM_HELP.
Public Sub OpenHelp(ByVal ContextId As Long)
Dim hwndHelp As Long
'The return value is the window handle of the created help window.
Dim hwndHH
hwndHH = HtmlHelp(0, ThisWorkbook.Path & "\" & AppId & ".chm",
HH_HELP_CONTEXT, ContextId)
End Sub
where ContextId is defined in the HTML help file creation , and AppId is the
application name (assuming that is used for your help file).
One note, OpenHelp is probably not a good name to use. I had a problem with
one of my addins that conflicted with one of Rob Bovey's, because we both
used that procedure name.
--
HTH
Bob Phillips
(replace somewhere in email address with gmail if mailing direct)
"Alan" wrote in message
ups.com...
I am writing a compiled html help file (.chm format) to be used with a
specific workbook. How can I open and read the help file from within
the workbook?
|