Loading
Word.Tips.Net WordTips (Menu Interface)

Specifying a Table of Contents Entry

Please Note: This article is written for users of the following Microsoft Word versions: 97, 2000, 2002, and 2003. If you are using a later version (Word 2007 or later), this tip may not work for you. For a version of this tip written specifically for later versions of Word, click here: Specifying a Table of Contents Entry.

If you are creating a regular table of contents from headings within the document, you don't need the information in this tip. Instead, you should refer to the TOC tips provided in other issues of WordTips. If you are creating a specialized TOC, however, then you will need the information in this tip. Examples of a specialized TOC would be a table of figures, illustrations, or tables. To create these types of TOCs, you must follow these two basic steps:

  1. Specify what you want in the TOC.
  2. Generate the TOC.

The first step is done by the following these steps; the second is covered in the next tip.

  1. Position the insertion point immediately after the text you want included in the TOC.
  2. Press Ctrl+F9 to insert a set of field braces. Make sure the insertion point stays between the braces.
  3. Type tc, followed by the TOC entry within quotes. Thus, if you want the entry to be "North American Mammals", enter tc "North American Mammals" between the field braces.
  4. Repeat steps 1 through 3 for each TOC entry you want to define.

WordTips is your source for cost-effective Microsoft Word training. (Microsoft Word is the most popular word processing software in the world.) This tip (1399) applies to Microsoft Word 97, 2000, 2002, and 2003. You can find a version of this tip for the ribbon interface of Word (Word 2007 and later) here: Specifying a Table of Contents Entry.

Related Tips:

Do More in Less Time! Are you ready to harness the full power of Word 2013 to create professional documents? In this comprehensive guide you'll learn the skills and techniques for efficiently building the documents you need for your professional and your personal life. Check out Word 2013 In Depth today!

 

Leave your own comment:

*Name:
Email:
  Notify me about new comments ONLY FOR THIS TIP
Notify me about new comments ANYWHERE ON THIS SITE
Hide my email address
*Text:
*What is 5+3 (To prevent automated submissions and spam.)
 
 
           Commenting Terms

Comments for this tip:

Ken Endacott    03 Sep 2016, 08:43
The method that I suggest is to place a bookmark just preceding the TOC, then insert a small image in the margin to the left of each heading and apply a hyperlink to the image. Clicking on the image will then cause the selection to jump back to the bookmark at the TOC.

The image can be a picture or shape but it must have "Through" wrapping style. It can then be dragged into position in the margin to the left of the heading. Right click on the image and select Hyperlink then select "Place in This Document" and select the bookmark.

If you are really cunning you could use a borderless empty shape such as a small circle that would not show up when you print.

When setting up or adjusting the shape's position it is annoying that clicking the shape causes a jump to the TOC. Set Options > Advanced and tick "Use CTRL + Click to follow hyperlink" to avoid this. Don't forget to change back when you have finished.

Of course a suitable macro could do all of this for you with one click.
Len    02 Sep 2016, 16:38
Hi Ken. Thanks for this but code like this makes my you-know-what pucker. Could it be possible to create a button or talisman of sorts which I could place beside each heading to take me to the ToC. I don't care about going to the specific entry I clicked.

Let me know.

Len
BTW, impressive coding. I wish I could do that.
Ken Endacott    13 Aug 2016, 07:03
Len
The first macro links headings back to the appropriate line in the TOC. If you change headings or re-create the TOC then you should remove the reverse links with the second macro and then re-create them.

Sub HyperlinkHeadings()
Dim hyp As Hyperlink
Dim toc As TableOfContents
Dim bkmk As String
Dim bkmkR As String
Dim sCode As String
  If ActiveDocument.TablesOfContents.Count = 0 Then
    MsgBox "There are no Tables of Contents in document"
    Exit Sub
  End If
  Options.CtrlClickHyperlinkToOpen = True
  Set toc = ActiveDocument.TablesOfContents(1)
  For Each hyp In toc.Range.Hyperlinks
    bkmk = hyp.SubAddress
    bkmkR = bkmk & "R"
    hyp.Range.Select
    If Selection.Bookmarks.Count = 0 Then
      ActiveDocument.Bookmarks.Add Range:=Selection.Range, Name:=bkmkR
    Else
      bkmkR = Selection.Bookmarks(1).Name
    End If
    If ActiveDocument.Bookmarks.Exists(bkmk) Then
      ActiveDocument.Bookmarks(bkmk).Range.Select
      If Selection.Hyperlinks.Count = 0 Then
        With ActiveDocument.Hyperlinks.Add(Anchor:=Selection.Range, _
           Address:="", SubAddress:=bkmkR, TextToDisplay:=Selection.Text)
          .Range.Select
          Selection.ClearCharacterAllFormatting
        End With
      Else
       Selection.Range.Hyperlinks(1).Range.Select
       Selection.Fields.Unlink
        sCode = Selection.Text
        With ActiveDocument.Hyperlinks.Add(Anchor:=Selection.Range, _
           Address:="", SubAddress:=bkmkR, TextToDisplay:=sCode)
          .Range.Select
          Selection.ClearCharacterAllFormatting
        End With
        ActiveDocument.Bookmarks.Add Range:=Selection.Range, Name:=bkmk
      End If
    End If
  Next hyp
  Options.CtrlClickHyperlinkToOpen = False
End Sub

Sub RemoveReverseLinks()
Dim hyp As Hyperlink
Dim toc As TableOfContents
Dim bkmk As String
  If ActiveDocument.TablesOfContents.Count = 0 Then
    MsgBox "There are no Tables of Contents in document"
    Exit Sub
  End If
  Set toc = ActiveDocument.TablesOfContents(1)
  For Each hyp In toc.Range.Hyperlinks
     bkmk = hyp.SubAddress
     If ActiveDocument.Bookmarks.Exists(bkmk) Then
       ActiveDocument.Bookmarks(bkmk).Range.Select
       Selection.MoveEnd unit:=wdCharacter, Count:=-1
       If Selection.Hyperlinks.Count > 0 Then
         Selection.Range.Hyperlinks(1).Range.Select
         Selection.Fields.Unlink
         ActiveDocument.Bookmarks.Add Range:=Selection.Range, Name:=bkmk
         If ActiveDocument.Bookmarks.Exists(bkmk & "R") Then
           ActiveDocument.Bookmarks(bkmk & "R").Delete
         End If
       End If
     End If
   Next hyp
End Sub
Len Babin    12 Aug 2016, 14:59
A while back, I asked how I could click on a ToC item, go to the heading in the text, then click back to the ToC. I got some good suggestions but no solutions.

I just received an HTML email with a ToC in it. Beside each heading in the text is a link which says "Return to Headlines" (the ToC) That makes me think that I could do this in a Word document. How can I create a link at each heading that will take me back to the ToC, ideally to the header link but at least to the top of the ToC?

Thanks - Len
 
 

Our Company

Sharon Parq Associates, Inc.

About Tips.Net

Contact Us

 

Advertise with Us

Our Privacy Policy

Our Sites

Tips.Net

Beauty and Style

Cars

Cleaning

Cooking

DriveTips (Google Drive)

ExcelTips (Excel 97–2003)

ExcelTips (Excel 2007–2016)

Gardening

Health

Home Improvement

Money and Finances

Organizing

Pests and Bugs

Pets and Animals

WindowsTips (Microsoft Windows)

WordTips (Word 97–2003)

WordTips (Word 2007–2016)

Our Products

Helpful E-books

Newsletter Archives

 

Excel Products

Word Products

Our Authors

Author Index

Write for Tips.Net

Copyright © 2016 Sharon Parq Associates, Inc.