Open Chm Files:
When opening Chm files from Excel you can use the FollowHyperlink Method.
ActiveWorkbook.FollowHyperlink Address:="C:\WINDOWS\HELP\31users.chm", NewWindow:=True
The problem with this is that you will be given a warning message from the Windows application asking you :
Using Application.DisplayAlerts does NOT overide this Microsoft Office Alert.
Here is ONE way to bypass it using the [hhctrl.ocx].
The 1st method is the easiest if you just want to open the help file.
The 2nd method offers more control / options.
METHOD1:
Sub Open_ChmHelp()
Shell "C:\WINDOWS\hh.exe C:\WINDOWS\HELP\msoe.chm", vbMaximizedFocus
End Sub
METHOD2:
[From Microsoft]
The HTML Help ActiveX control (Hhctrl.ocx) provides a rich feature set for help systems. Key features include: an expanding table of contents, keyword search, shortcuts, and pop-up help topics. The control is one of the authoring components that ships with Microsoft HTML Help. It is also included with many third-party HTML Help authoring tools. To find the HTML Help registry key
You can determine if HTML Help is installed on a computer by checking for the HTML Help registry key.
Click Start, and then click Run.
Type regedit in the Open box, and then click OK. This will open the Microsoft Registry Editor.
Click Find on the Edit menu, and then search for the following CLSID:
ADB880A6-D8FF-11CF-9377-00AA003B7A11
This is the CLSID of the HTML Help ActiveX Control (Hhctrl.ocx). It is registered by the system during setup. If Hhctrl.ocx is installed on your system, the CLSID will be found under HKEY_CLASSES_ROOT/CLSID. If it is not found, Hhctrl.ocx is not installed.
The control provides functionality for two types of help systems:
A compiled help (.chm) file
The control uses both an Internet Explorer DLL (Shdocvw.dll) and the HTML Help compiler to offer a variety of features. Users view compiled help files in the Help Viewer. Compiled help files often ship with the programs that they document.
Uncompiled HTML files on a Web site:
The control uses Microsoft Internet Explorer to provide a subset of its feature set. The features of HTML Help can be used on a Web site to present a wide variety of content, from Web-based help to a Web site focused on entertainment.
Notes
The HTML Help ActiveX control is designed to work with Internet Explorer and the Shdocvw.dll component. It does not include the design-time support that is necessary to use it with development tools, such as Microsoft Visual Basic Scripting Edition and Microsoft Visual C++.
For more information about ActiveX technology, see
Option Explicit
Private Declare Function HtmlHelp Lib "hhctrl.ocx" _
Alias "HtmlHelpA" ( _
ByVal hwndCaller As Long, _
ByVal pszFile As String, _
ByVal uCommand As Long, _
ByVal dwData As Long) As Long
'// Some constants to use
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.
Const HH_CLOSE_ALL = &H12
Sub OpenHelp()
Dim hwndHelp As Long
'// The returned value is the window handle of the created help window.
hwndHelp = HtmlHelp(0, "C:\WINDOWS\HELP\msoe.chm", HH_DISPLAY_TOPIC, 0)
If hwndHelp = 0 Then MsgBox "Can't load"
End Sub
Sub CloseHelp()
HtmlHelp 0, "", HH_CLOSE_ALL, 0
End Sub
Sub Tester()
'// Display Alerts DOES NOT Work
With Application
.DisplayAlerts = False
ActiveWorkbook.FollowHyperlink _
Address:="C:\WINDOWS\HELP\msoe.chm", NewWindow:=True
.DisplayAlerts = True
End With
End Sub