Graham Mayor

... helping to ease the lives of Microsoft Word users.

Many people access the material from this web site daily. Most just take what they want and run. That's OK, provided they are not selling on the material as their own; however if your productivity gains from the material you have used, a donation from the money you have saved would help to ensure the continued availability of this resource. Click the appropriate button above to access PayPal.

Table of Contents

The add-in, like the other add-ins available from my web site is a macro enabled template intended to be inserted in the Word startup folder from where it is loaded into Word when Word is started, and replaces the TOC group on the References Tab of Word 2007 and later. A self extracting zip file will attempt to install the template in the default Word startup folder. Install the template with Word closed.

If you have not changed the preferred startup folder it can be located (in English language versions of Windows) by typing
%appdata%\Microsoft\Word\Startup
in the Windows Explorer Address bar and pressing Enter.

There are four buttons and two dropdown items:

The buttons are:

 1. Insert Table of Contents

Although this is the first button on the form, it is actually the last to be used. This button places (or replaces) a TOC field at the cursor with the options selected from the Userform (below).

By default the Title and Heading 1 and 2 styles are selected, but you can select any of the available heading styles. You can also choose not to insert the values from TC fields in the Table of Contents by unchecking the check box.

The heading levels displayed in the Table of Contents are determined by their position in the order of selection. If, for example, you have only used the Heading 2 style in your document, then select only Heading 2 from the available list. If the heading levels appear somewhat awry in the Table of Contents inserted into the document, you can always run this function again and replace the original table at the prompt.

Clicking the GM logo will link to this web page. The first time any one of the elements from the add-in, that employs a userform, is run, a standard disclaimer text is displayed:

2. Insert TOC based on TC Fields

This option does not work in conjunction with a userform. If there are Table of Content Entry (TC) fields in the document a Table of Contents based upon them will be inserted, with the option to replace an existing table of contents).

3. Delete TOC Items

Clicking this button opens a dropdown menu with three further options

 

Delete Table of Contents - should require no further explanation.

Delete Style Separators - See the section later on the use of Style Separators. This function provides a simple way to delete any that have been entered.

Delete TC Field Level - When the option (discussed later) to mark text for inclusion in the Table of Contents is used, the hidden TC fields used to create the entries are set at a specific level. This function provides the ability to delete all TC fields pertaining to a certain text, or just those set at a specific heading level.

4. Mark TOC Entry

This option allows the user to mark selected texts in the document for inclusion in the Table of Contents.

The selected text is shown in the main text box of the above userform. If that text is not exactly what was intended, you can click back into the document (the userform will remain on screen) and then reselect the text. When the userform is again clicked, the text box is updated to show the new selection. Or you can simply type the required entry in the userform.

The userform allow for just the one entry to be marked, or all instances of the indicated text to be marked.

The heading level is used to set the indentation position of the inserted item in the Table of Contents. The next button allows that level to be changed.

5. Change TC Field Level

Using this function you may change the heading level of the selected field (currently shown as level 1 in the illustration) or of all fields relating to the marked text.

6. Misc TOC Items

This button opens a second dropdown menu

The first item is the most interesting of the options and it was a request by a Microsoft Answers Forum user for such a function that prompted me to develop this add-in.

Insert Style Separator

 It is used in conjunction with the 9 built-in Heading Styles to limit what is included from such a style in the Table of Contents. This is easier to demonstrate with illustrations than with text.

In the following illustration, are three heading paragraphs. The table of contents based on those headings will appear as shown below it.


Here I have used random text, but for the sake of argument I want to display only part of each heading in the Table of Contents. In the case of the first line, I want to include the text up to 'dolor'. In the second heading I want the text up to 'nibh' and in the third example I want the text up to 'magna'.


The Style Separator splits the paragraph at the cursor into two similarly formatted paragraphs with a hidden paragraph break. The first paragraph has the original style that will be used in the Table of Contents, the second has a new style based on the first paragraph style. The result is that only the first paragraph is included in the table of contents as shown below the example.


Update TOC - The functions that require the TOC to be updated perform the updating, but there may be occasions when it is desirable to update a TOC and this button will do it.

Viewing

The final three buttons provide various viewing options to hide or display the workings of the add-in within the document. They have no effect on the document other than to change the view options so you can click through bthem to get a better idea of what they do.

- Click here to download the add-in

 

 

 Tables of Contents

I have felt that the tools provided in Word, at least since Word 2007, have not been the most intuitive and some of them have been hidden altogether.

The add-in featured on this page helps bring together the various Table of Contents tools in a format that makes it relatively simple to create a table of contents based on heading styles and/or marked text items.