ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Addressing a Help File (https://www.excelbanter.com/excel-programming/372448-addressing-help-file.html)

Alan

Addressing a Help File
 
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?


Bob Phillips

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?




Alan

Addressing a Help File
 
Thanks Bob,

I'll have a go and keep you posted.

Alan

Bob Phillips wrote:
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?



Alan

Addressing a Help File
 
Bob,

I'm having trouble with the ContextId. When I try to run the macro I am
getting a "HTML Help Author Message" stating that "HH_HELP_CONTEXT
called without a [MAP] section"

I'm not sure what value the ContextId should take or how it is defined
in the HTML help file creation but having looked at some of the work of
Rob Bovey I've been trying to use a value of 120.

Alan


Bob Phillips wrote:
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?



Bob Phillips

Addressing a Help File
 
Alan,

That would depend upon how you setup your HTML file, all of the maps etc.,
which I can't comment on.

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"Alan" wrote in message
oups.com...
Bob,

I'm having trouble with the ContextId. When I try to run the macro I am
getting a "HTML Help Author Message" stating that "HH_HELP_CONTEXT
called without a [MAP] section"

I'm not sure what value the ContextId should take or how it is defined
in the HTML help file creation but having looked at some of the work of
Rob Bovey I've been trying to use a value of 120.

Alan


Bob Phillips wrote:
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?






All times are GMT +1. The time now is 01:10 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com