Adding context sensitive help to my Excel workbook

Viewed 333

I have developed a fairly complex Excel workbook. Now I want to document it. I discovered MS compiled HTML file. So I wrote a document in Word that contains detailed information about each sheet in my workbook. I saved it and use the MS HTML Help Workshop and the chmProcessor that I downloaded from the web. Eventually I got it to work and created the .CHM file. In my workbook I wrote a sub that looks like this:

Sub getHelp()
    Dim currentPath As String
    currentPath = ActiveWorkbook.Path
    Application.Help (currentPath & "\LogicAndAccuracyTesting.chm")
End Sub

It all works. From my workbook, I set {f1} to call getHelp and it does display my documentation.

Help also support the HelpContextID property. I want to use it to display the exact topic that the user has asked for help.

How do I get the HelpContextID from my Word document? If I save the .docx file as a .htm file, how can I get the HelpContextID? How do I use 2 components of office (Word and Excel) to create a tightly integrated help system? I'm not a professional developer at this point so I don't want to spend a lot of money on a professional help authoring system.

Thank you for your help.

1 Answers

HelpContextID has a learn curve when using CHM files. ChmProcessor makes it a bit difficult too. ChmProcessor is not well suited for using contextID's. But give it a try (the man's way).

  • First use the Generate help project option
  • Copy the file names generated into the foobar.hhp file (open by e.g Notepad++) to a file named alias.h
  • Edit the lines into the format described at: ALIAS and MAP files
  • Create a map.h file as described (see link above).
  • Save the file as alias.h and map.h in same folder as your help project file *.hhp

Add following section to your e.g foobar.hhp file:

[ALIAS]
#include alias.h

[MAP]
#include map.h

Save the files you created in another place too!

Compile your help project by using HTMLHelp Workshop or other freeware tools like FAR HTML.

As for test case only I add a CHM help file call below. Please note, you'll get one help viewer window showing the default topic by this code (edit the code for your needs). After a click to the help button (in German "Hilfe") the topic related to HelpContextID:=20010 is shown in another window.

Function TestMacro()
'----------------------------------------------------------------
' Display a message box with a help button linked to a help topic
'----------------------------------------------------------------
    Dim currentPath As String
    currentPath = ActiveWorkbook.Path
    Application.Help HelpFile:=currentPath & "\CHM-example.chm", HelpContextID:=0

    '--- MsgBox sample code -------------------------------------
    MsgBox "The 'Hello World' message for testing this function!.", _
    Buttons:=vbOKOnly + vbMsgBoxHelpButton, _
    HelpFile:=ActiveWorkbook.Path & "\CHM-example.chm", _
    Context:=20010
End Function

enter image description here

Related