Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Opening a CHM file
|
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Opening a CHM file
Code I use.... but not written by me:
Option Explicit Option Private Module 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. 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 ' HTML Help file launched in response to a button click: Private Sub ViewHelpFile() ' hWnd is a Long defined elsewhere to be the window handle ' that will be the parent to the help window. Dim hwndHelp As Long Dim hWnd As Long ' The return value is the window handle of the created help window. hwndHelp = HtmlHelp(hWnd, "myfile.chm", HH_DISPLAY_TOPIC, 0) End Sub ' ' A specific topic identified by the variable ContextID is launched ' ' in response to this button click: Private Sub HH_HELP_Click() Dim hwndHelp As Long 'The return value is the window handle of the created help window. hwndHelp = HtmlHelp(hWnd, "myfile.chm", HH_HELP_CONTEXT, ContextID) End Sub Avi wrote: Hello, How do i open a CHM(help) file with a macro? Thanks Avi Benita www.avibenita.com |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Opening a CHM file
Thanks for the prompt and detailed answer. But it seems to me that my problem is a lot simpler. Actually, i have an all ready CHM file, and all what i need is a macro that refers to it and opens it as is *** Sent via Developersdex http://www.developersdex.com *** |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Opening a CHM file
I guess I should have included some explanation with my response. :-)
The code I posted before allows you to launch the CHM file -- as you need. (The additional code enabled you to address specific topics within the file. You would use that if, for example, you were implementing context sensitive help). Below, I've reposted the code but removed the extraneous details leaving just that required to show a CHM file. I've also changed it slightly so it's a function to which you just pass the path, returning true if the launch failed. So you would call it thus: If not ViewHelpFile ("c:\myhelpfile.chm") then MSGBOX "Sorry, couldn't launch the help file..." End if 'Place at top of code module Const HH_DISPLAY_TOPIC = &H0 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 Function ViewHelpFile(myFullPath as string) as boolean 'Returns true if file was successfully launched Dim hwndHelp As Long Dim hWnd As Long 'The return value is the window handle of the created help window. hwndHelp = HtmlHelp(hWnd, myFullPath, HH_DISPLAY_TOPIC, 0) If hwndHelp 0 then ViewHelpFile = true End Sub Avi Benita wrote: Thanks for the prompt and detailed answer. But it seems to me that my problem is a lot simpler. Actually, i have an all ready CHM file, and all what i need is a macro that refers to it and opens it as is *** Sent via Developersdex http://www.developersdex.com *** |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Opening a CHM file
Many thanks. Works perfectly...
Avi Avi Benita 054-4660641 wwwAvi Benita 054-4660641 www.avibenita.com "Gman" <nah wrote in message ... I guess I should have included some explanation with my response. :-) The code I posted before allows you to launch the CHM file -- as you need. (The additional code enabled you to address specific topics within the file. You would use that if, for example, you were implementing context sensitive help). Below, I've reposted the code but removed the extraneous details leaving just that required to show a CHM file. I've also changed it slightly so it's a function to which you just pass the path, returning true if the launch failed. So you would call it thus: If not ViewHelpFile ("c:\myhelpfile.chm") then MSGBOX "Sorry, couldn't launch the help file..." End if 'Place at top of code module Const HH_DISPLAY_TOPIC = &H0 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 Function ViewHelpFile(myFullPath as string) as boolean 'Returns true if file was successfully launched Dim hwndHelp As Long Dim hWnd As Long 'The return value is the window handle of the created help window. hwndHelp = HtmlHelp(hWnd, myFullPath, HH_DISPLAY_TOPIC, 0) If hwndHelp 0 then ViewHelpFile = true End Sub Avi Benita wrote: Thanks for the prompt and detailed answer. But it seems to me that my problem is a lot simpler. Actually, i have an all ready CHM file, and all what i need is a macro that refers to it and opens it as is *** Sent via Developersdex http://www.developersdex.com *** |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
opening a file in Excel starts application but dose not open file | Excel Discussion (Misc queries) | |||
File:1 and File:2 -- Double Files when Opening One File | Excel Discussion (Misc queries) | |||
opening an excel file opens a duplicate file of the same file | Excel Discussion (Misc queries) | |||
Error:Invalid File format,while opening an Excel Template file | Excel Programming |