ExcelBanter

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

mangesh_yadav[_41_]

Help File
 
Hi everyone,

I need some help on creating help files for an application made i
excel (and VBA). Any leads....

maybe something like a windows help file. I know a little about .ch
files, but nothing about creating windows help files.

- Manges

--
Message posted from http://www.ExcelForum.com


Bob Phillips[_6_]

Help File
 
You can use HTML help files in an Excel application.

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).

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"mangesh_yadav " wrote in
message ...
Hi everyone,

I need some help on creating help files for an application made in
excel (and VBA). Any leads....

maybe something like a windows help file. I know a little about .chm
files, but nothing about creating windows help files.

- Mangesh


---
Message posted from http://www.ExcelForum.com/




mangesh_yadav[_43_]

Help File
 
Thanks Bob,

When I tried to run your code, I get a runtime error '453': Can't fin
DLL entry point HtmlHelp in hhctrl.ocx

Is it something to do with the contextId that is passed to th
function.


By the way, I tried the following piece of code, but my excel shee
crashes when I run it.

''''''''''''''''' code starts here ''''''''''''''''''''''

Const HH_DISPLAY_TOPIC = &H0

Declare Function HtmlHelp Lib "hhctrl.ocx" Alias "HtmlHelpA" ()

Sub DisplayHTMLHelp()
Dim hwndHelp As Long
hwndHelp = HtmlHelp(0, "C:\WM.chm", HH_DISPLAY_TOPIC, 0)
End Sub

''''''''''''''''' code ends here ''''''''''''''''''''''

Any idea...!!!




- Manges

--
Message posted from http://www.ExcelForum.com


mangesh_yadav[_44_]

Help File
 
I found the bug. Thanks anyway

Manges

--
Message posted from http://www.ExcelForum.com


Bob Phillips[_6_]

Help File
 
What was the bug Mangesh?

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"mangesh_yadav " wrote in
message ...
I found the bug. Thanks anyway

Mangesh


---
Message posted from http://www.ExcelForum.com/




mangesh_yadav[_45_]

Help File
 
There was no bug in your code. I am using it nicely now. Somehow whil
trying to use it I must have commented a part and sometimes the fil
used to crash or sometimes i used to get the above error I mentioned.

But after uncommenting that part, it started working perfectly.

The bug that I introduced was:

I had empty brackets instead of the following

(ByVal hWnd As Long, _
ByVal lpHelpFile As String, _
ByVal wCommand As Long, _
ByVal dwData As Long)

- Manges

--
Message posted from http://www.ExcelForum.com


Bob Phillips[_6_]

Help File
 
That's one of the problems with APIs, if you get the call wrong, it crashes
spectacularly.

--

HTH

RP

"mangesh_yadav " wrote in
message ...
There was no bug in your code. I am using it nicely now. Somehow while
trying to use it I must have commented a part and sometimes the file
used to crash or sometimes i used to get the above error I mentioned.

But after uncommenting that part, it started working perfectly.

The bug that I introduced was:

I had empty brackets instead of the following

(ByVal hWnd As Long, _
ByVal lpHelpFile As String, _
ByVal wCommand As Long, _
ByVal dwData As Long)

- Mangesh


---
Message posted from http://www.ExcelForum.com/





All times are GMT +1. The time now is 12:22 PM.

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