Microsoft KB Archive/123057

= WD: Incorrect Formatting in Index or Table of Contents =

Article ID: 123057

Article Last Modified on 11/23/2006

-

APPLIES TO


 * Microsoft Word 6.0 Standard Edition
 * Microsoft Word 6.0a
 * Microsoft Word 6.0c
 * Microsoft Word 95 Standard Edition
 * Microsoft Word 6.0 for Macintosh
 * Microsoft Word 6.0 Standard Edition

-



This article was previously published under Q123057





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.



WORKAROUND
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:

https://partner.microsoft.com/global/30000104

For more information about the support options that are available and about how to contact Microsoft, visit the following Microsoft Web site:

http://support.microsoft.com/default.aspx?scid=fh;EN-US;CNTACTMS

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:

122706 Table of Contents Shows Wrong Formatting

Additional query words: fields macros toc index update updating xe tc direct manual format formatting

Keywords: kbformat kbmacroexample kbprb kbfield KB123057

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.