Shell function

J

John Keturi

I am trying to shell to a Windows help file (.chm) from a Excel worksheet,
....however, it doesn't seem
to work. Shell works for notebook, calculator, etc.,but not a .chm file. How
can I get VB to open this help file from within a macro button placed on a
Excel form..
Jjk
 
R

Rob Bovey

John Keturi said:
I am trying to shell to a Windows help file (.chm) from a Excel worksheet,
...however, it doesn't seem
to work. Shell works for notebook, calculator, etc.,but not a .chm file. How
can I get VB to open this help file from within a macro button placed on a
Excel form..

Hi John,

There are a couple of ways you can do this. The Application.Help method
will display the file:

Application.Help ThisWorkbook.Path & "\MyHelpFile.chm"

I don't like this method because it tries to automatically tile the help
file and Excel windows, so I use the HtmlHelp API instead:

Public Declare Function HtmlHelpA Lib "hhctrl.ocx" _
(ByVal hwnd As Long, _
ByVal lpHelpFile As String, _
ByVal wCommand As Long, _
ByVal dwData As Long) As Long

Sub DisplayHelpFile()
HtmlHelpA 0&, ThisWorkbook.Path & "\MyHelpFile.chm", 0&, 0&
End Sub

--
Rob Bovey, MCSE, MCSD, Excel MVP
Application Professionals
http://www.appspro.com/

* Please post all replies to this newsgroup *
* I delete all unsolicited e-mail responses *
 
Top