ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Shell function (https://www.excelbanter.com/excel-programming/299176-shell-function.html)

John Keturi

Shell function
 
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



Rob Bovey

Shell function
 
"John Keturi" wrote in message
news:jcSrc.15633$PU5.6123@fed1read06...
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 *





All times are GMT +1. The time now is 05:33 PM.

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