Convert HTML Saved In Word to CHM Topic Files

 

Included in this distribution:

1.  HtmlDocToTopic.macrovba - a text file containing the macro code

2.  HtmlDocToTopic.readme - this documentation file

 

Documentation is often created easily with Microsoft Word, creating links to external documents and internal bookmarks.  Heading levels can be specified.  Images can be inserted into the text.  This kind of documentation is appropriate when it is to be printed in hard copy.  Word also gives the user the ability to save the document as filtered HTML. Such an html document may be useful as a separate documentation tool.  But, for documentation integrated into an application, a Html Help CHM file is ideal. 

 

This VBA tool can be run as a macro in Word.  The HtmlDocToTopic.macrovba is a text file containing the macro code.  It converts filtered html to Html Help Topic files.  Use the following steps to convert a Word DOC file to a CHM file.  You may have simpler ways to do certain steps, but these will work.

 

When you run the macro in Step 8, you will see a brief search of the doc file as the macro performs some initial conversions followed by flashing pages as new documents are being opened and saved.  These are the html Topic files.

 

To Create HTML Help from a txt file containing HTML created from a Word document:

 

Set up your Html Help Workshop

1.         Run \program files\HTML Help Workshop\hhw.exe.

2.         In hhw for your document, open an existing or create a new html help project, for example, myProject.hhp. In project properties, set to create Index and Table of Contects automatically it that is what you desire.

3.         In Project Tab buttons, select “Add/Remove topic files” button.  Remove any files that will be replaced—usually, all the files.

 

Convert a Word DOC file to Html Help Topic html files.

4.         Open the DOC file and save as "filtered HTML."

5.         Open the html in Notepad to preserve the HTML tags.

6.         Save this file to a .txt file.

7.         Open the .txt file in Word.

8.         Run the convertFromDocToHH macro to create the Topic files for the HTML HELP Workshop program.

 

Create the CHM file.

9.         In the HTML Help Workshop, select the “Add/Remove topic files” and add the created topic files.  Usually, the last file is listed first for some reason.  Remove it and add it again to have it located at the end of the list.  The  “Contents” is created based on the order here.

10.       Press the HTML Help Workshop “Save all files and compile” button.  This creates the CHM file that will be included in the distribution.