How to attach/include a .chm file to the Click function on a Help->Topics menu?

vlg
vlg used Ask the Experts™
on
Hello

I have a small app, and I have a menu that has Help as an option.  Clicking on Help, you get the About option and a Help Topics option.
When the user clicks on the Help Topics option, I want the myHelp.chm file to be launched (it's MS HTML Help) in it's own little window (as normally happens).

Thanks

v
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
'Declare API
Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long

'Call it
Public Function OpenHelpFile()
   Dim lngRetVal
   Dim strLocation
   strLocation = app.path & "myHelp.chm" 'Here you put the path to your chm
   lngRetVal = ShellExecute(me.hwnd,"open",strLocation,vbnullString,vbNullString,vbNullString)
   if lngRetVal > 53    
        msgbox "Failure Attempting to Open Help File!"
   end if
End Function

give that a try....

Or

try this: http://www.vbaccelerator.com/codelib/shell/shellex.htm

TwistD
Commented:
You could also set the help file at load time and if the user presses F1 it will start it up automatically:
App.HelpFile = App.Path & "\Help.chm"

and

Help menu item (click event):
SendKeys "{F1}", False
vlg

Author

Commented:
Hi TwistD

I'm getting a Run time error 13 "type mismatch" when I run your code.
Any thoughts?

Thanks rushka21, I'll try yours now.

Commented:
No Problem..

Regards
R

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial