Excel VBA 2003 Addin trying to map Context id to .chm file

S

Stevo5858

Hi,



This is my first ever post. I'm trying to create context sensitive support
for my Excel userform to a chm file I've created in HTML workshop and keep
getting the following error:



"The C:\filename.chm file is not a Windows Help File, or the file is
corrupted."



My aim is to use no code and simply to match the field in my userform to the
help file by the user pressing F1 in my addin.



The mapping looks correct between Helpmatic Pro and Excel, I've set the
(Excel) Project properties help file name as the chm file I've compiled and
left the Context ID as 0. In my userform, I've correlated the various
textboxes and combolists to Help Context ids of 20,000 or more and checked
that this mapping is correct. This returns the above error.



I've done some research on this. I can confirm that hh.exe maps to chm files
in Folder Options. There is no unblock properties in properties of the file.
I've renamed the hh.dat file in my profile to generate a new copy. The help
chm file is on my local drive. I've tried this on a colleague's machine with
the same error. I've tried opening the file through cmd line, the chm file
displays without error but as soon as I specify the context id the window
does not display.



Is there a security update that could be causing the issue? If anyone has
any ideas I would be most appreciative.
 
P

Peter T

I've never found a way to do what I think you are trying to do, at least not
calling the chm with F1 in a form though it is possible to map a chm to the
function wizard help button for UDF's.

AFAIK in a form the only way is to call the help API, eg

Private Declare Function HTMLHelp Lib "hhctrl.ocx" Alias "HtmlHelpA" (ByVal
hwnd As Long, ByVal lpHelpFile As String, ByVal wCommand As Long, ByVal
dwData As Any) As Long

Const HH_DISPLAY_TOPIC = &H0
Const HH_HELP_CONTEXT = &HF

Private Sub CommandButton1_KeyDown( _
ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer)
If KeyCode = vbKeyF1 Then

gnHHwin = HTMLHelp(0&, sHelpFile, HH_HELP_CONTEXT, 20100&)
End If
End Sub

It's a bit of a learning curve I'm afraid but it's all out there. This just
to set you looking in the right direction.

Regards,
Peter T
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top