Help File from Properties?

Heatshiver

Registered User.
Local time
Today, 20:54
Joined
Dec 23, 2011
Messages
263
I have a .CHM help file ready to go and I'd like to place a button in my Access database. I read up on how to add it here initially:

http://support.microsoft.com/kb/296231

This didn't seem to work when I pressed F1, and I made sure the file was in the same folder as the database (along with the other steps).

I then tried using VBA code from both of these links:

http://www.nogoodatcoding.com/howto/introduction-to-microsoft-help-workshop

http://msdn.microsoft.com/en-us/library/aa140540(v=office.10).aspx

I understand that the first seems to reference just VB, and the second is for Excel. I did try to manipulate the code, but nothing seems to work. Does anyone know a VBA code that will refer to the .CHM help file?
 
The code I use is below. I can't remember where I got it from. I have probably altered it but I didn't write it and take no credit for it.
I have it in a module. It can be called with this line of code to open help at a particular page:
Call OpenMyHelp("NameOfHelpPage")
or call wth:
Call OpenMyHelp
to just get it open.

Hope this helps.

Code:
Declare Function HtmlHelp Lib "HHCtrl.ocx" Alias "HtmlHelpA" _
    (ByVal hwndCaller As Long, _
     ByVal pszFile As String, _
     ByVal uCommand As Long, _
     dwData As Any) As Long
 
Const HH_Display_TOPIC = &H0
Public Sub OpenMyHelp(Optional strPageName As String)
On Error GoTo Err_ErrorHandler
 
If strPageName = "" Then
    Call HtmlHelp(0, CodeProject.Path & "\[B][COLOR=#ff0000]YourHelpFileName[/COLOR][/B].chm", HH_Display_TOPIC, ByVal "Introduction.htm")
Else
    Call HtmlHelp(0, CodeProject.Path & "\[B][COLOR=#ff0000]YourHelpFileName[/COLOR][/B].chm", HH_Display_TOPIC, ByVal strPageName & ".htm")
End If
 
'' Specifying 1 as the second argument opens the application in
'' normal size and gives it the focus.
'Dim RetVal
'RetVal = Shell(CodeProject.Path & "\[B][COLOR=#ff0000]YourHelpFileName[/COLOR][/B].chm", 1)
 
Exit_ErrorHandler:
    Exit Sub
 
Err_ErrorHandler:
    MsgBox Err.Description & ". ErrNum " & Err.Number
    Resume Exit_ErrorHandler
End Sub

Please read this:

http://www.excelguru.ca/content.php?184
 
Last edited:
Thanks Bob! I'll give this a go.

I think I saw this in one of the pages I was perusing but had closed it.
 

Users who are viewing this thread

Back
Top Bottom