WD: Incorrect Formatting in Index or Table of Contents

Last reviewed: February 5, 1998
Article ID: Q123057
The information in this article applies to:
  • Microsoft Word for Windows, versions 6.0, 6.0a, 6.0c
  • Microsoft Word for Windows 95, version 7.0
  • Microsoft Word for the Macintosh, version 6.0
  • Microsoft Word for Windows NT, version 6.0

SYMPTOMS

Direct (or manual) formatting, such as bold or underline formats, applied to XE or TC fields are carried over to the table of contents and the index field results.

WORKAROUNDS

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 engineers 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 the Microsoft fee-based consulting line at (800) 936-5200. For more information about the support options available from Microsoft, please see the following page on the World Wide Web:

   http://www.microsoft.com/supportnet/refguide/ 

To avoid this problem, reset the XE or TC fields to the default formatting. To do this, use any of the following methods.

Method 1:

Select the XE or TC field and press CTRL+SPACEBAR. This forces the character formatting to return to the default of the current style.

Method 2:

Use a macro to automate this process. The following macro resets each of the XE fields in the document. Use this macro to reset direct formatting that affects your index.

          Sub MAIN
          Dim TOV As ToolsOptionsView
          GetCurValues TOV
          If TOV.ShowAll = 0 Then
             ToolsOptionsView .ShowAll = 1
             Change$ = "yes"
          End If
          EditBookmark .Name = "ClearFormats", .Add
          StartOfDocument
          EditFind .Find = "^d XE", .Direction = 0, .MatchCase = 0,
          .WholeWord = 0, .PatternMatch = 0, .SoundsLike = 0, .Format =
          0, .Wrap = 1
          While EditFindFound()
             ResetChar
             EditFind
          Wend
          StartOfDocument
          EditFind .Find = "^dXE", .Direction = 0, .MatchCase = 0,
          .WholeWord = 0, .PatternMatch = 0, .SoundsLike = 0, .Format =
          0, .Wrap = 1
          While EditFindFound()
             ResetChar
             EditFind
          Wend
          EditSelectAll
          UpdateFields
          EditGoTo .Destination = "ClearFormats"
          If Change$ = "yes" Then ToolsOptionsView .ShowAll = 0
          End Sub

Method 3:

Use the following macro to remove the direct formatting applied to each of the TC fields and then update the table of contents:

          Sub MAIN
          Dim TOV As ToolsOptionsView
          GetCurValues TOV
          If TOV.ShowAll = 0 Then
             ToolsOptionsView .ShowAll = 1
             Change$ = "yes"
          End If
          EditBookmark .Name = "ClearFormats", .Add
          StartOfDocument
          EditFind .Find = "^d TC", .Direction = 0, .MatchCase = 0,
          .WholeWord = 0, .PatternMatch = 0, .SoundsLike = 0, .Format =
          0, .Wrap = 1
          While EditFindFound()
             ResetChar
             EditFind
          Wend
          StartOfDocument
          EditFind .Find = "^dTC", .Direction = 0, .MatchCase = 0,
          .WholeWord = 0, .PatternMatch = 0, .SoundsLike = 0, .Format =
          0, .Wrap = 1
          While EditFindFound()
             ResetChar
             EditFind
          Wend
          EditFind .Find = "^19 toc"
          SendKeys "{F9}%e{enter}"
          EditGoTo .Destination = "ClearFormats"
          If Change$ = "yes" Then ToolsOptionsView .ShowAll = 0
          End Sub

STATUS

We are researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available.

MORE INFORMATION

For additional information on how manual formatting affects your table of contents when using styles, please see the following article in the Microsoft Knowledge Base:

   ARTICLE-ID: Q122706
   TITLE     : Table of Contents Shows Wrong Formatting


Additional query words: fields macros toc index update updating xe tc
direct manual format formatting
Keywords : kbfield kbformat kbmacroexample macword ntword winword word6 word7 word95 wordnt
Version : WINDOWS: 6.0, 7.0; MACINTOSH: 6.0, 6.0.1
Platform : MACINTOSH WINDOWS
Issue type : kbprb


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: February 5, 1998
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.