WD: Unwanted Extra Line(s) in Table of Contents (127744)



The information in this article applies to:

  • Microsoft Word for the Macintosh 6.0
  • Microsoft Word for the Macintosh 6.0.1
  • Microsoft Word for the Macintosh 6.0.1a
  • Microsoft Word for Windows NT 6.0
  • Microsoft Word for Windows 95
  • Microsoft Word for Windows 95 7.0a

This article was previously published under Q127744

SYMPTOMS

The results of a TOC (table of contents) field contain one or more extra, unwanted lines.

This problem occurs only if the headings in the document are formatted to use either automatic numbering or heading numbering AND if any part of the heading is also marked for an index entry. This problem occurs in Word for Windows 95, Word for Windows NT, and Word for the Macintosh. It does NOT occur with 16-bit Word for Windows running under Windows NT 3.5 or under Windows for Workgroups or Windows 3.1.

For example, headings formatted like this
   1.  Heading 1{XE "Heading 1"}
       1.1  Heading 2
            1.1.1  Heading 3
				
generate a table of contents that looks like this:
   1. Heading 1..............................1
   1. .......................................1
      1.1 Heading 2..........................1
          1.1.1 Heading 3....................1
				
Notice that there is an extra line in the table of contents under the line that contains the index entry. The extra line contains the same heading numbering as the line that contains the index entry, as if Word is trying to also number the index entry in the table of contents.

RESOLUTION

To resolve this problem, upgrade to the latest version of Microsoft Word.

To work around this problem, eliminate the extra lines in the table of contents. To do this, simply place the XE field at the beginning of the line of text rather than at the end. Do this for each XE field. For example:

  1. {XE "Heading 1"}Heading 1
When you update the table of contents by selecting it and pressing F9, the extra lines will be eliminated.

To automate the above process, create the following macro:
   Sub MAIN
      StartOfDocument
      ToolsOptionsView .FieldCodes = 1, .Hidden = 1
      EditFind .Find = "^19 xe", .Direction = 0, .Wrap = 1
      While EditFindFound()
      EditCut
      StartOfLine
      EditPaste
      EditFind
      Wend
   End Sub
				

STATUS

Microsoft has confirmed this to be a problem in the versions of Word listed above. This problem was corrected in Microsoft Word 97 for Windows and Word 98 Macintosh Edition.

MORE INFORMATION

Microsoft provides programming examples for illustration only, without warranty either expressed or implied, including, but not limited to, the implied warranties of merchantability and/or fitness for a particular purpose. This article assumes that you are familiar with the programming language being demonstrated and the tools used to create and debug procedures. Microsoft support professionals can help explain the functionality of a particular procedure, but they will not modify these examples to provide added functionality or construct procedures to meet your specific needs. If you have limited programming experience, you may want to contact a Microsoft Certified Partner or the Microsoft fee-based consulting line at (800) 936-5200. For more information about Microsoft Certified Partners, please visit the following Microsoft Web site: For more information about the support options that are available and about how to contact Microsoft, visit the following Microsoft Web site:

Modification Type:MinorLast Reviewed:8/16/2005
Keywords:kbbug kbfield kbfix KB127744