V
Vivian Carroll
In Word 2002, I recorded the following code to insert a TOC. Note that it is
only supposed to pick up four styles "C-Heading 1, C-Heading 2, C-Heading 3,
and C-Table Step 2."
The problem is that it is also picking up styles "C-Heading 4" and "C-Table
Step 3."
All of the "C-Heading" styles are based on to C-Heading 1 as part of an
outline numbering scheme. The "C-Table" styles are based on the C-Heading
styles of the same number and are then modified (for example, C-Table Step 3
is based on C-Heading 3).
How can I modify the code to prevent it from picking up C-Heading 4 and
C-Table Step 3 in the TOC?
With ActiveDocument
.TablesOfContents.Add _
Range:=Selection.Range, _
RightAlignPageNumbers:=True, _
UseHeadingStyles:=False, _
IncludePageNumbers:=True, _
AddedStyles:="C-Heading 1,1,C-Heading 2,2,C-Heading 3,3,C-Table
Step 2,2", _
UseHyperlinks:=True, _
HidePageNumbersInWeb:=True, _
UseOutlineLevels:=False
.TablesOfContents(1).TabLeader = wdTabLeaderSpaces
.TablesOfContents.Format = wdIndexIndent
End With
TIA, Vivian
only supposed to pick up four styles "C-Heading 1, C-Heading 2, C-Heading 3,
and C-Table Step 2."
The problem is that it is also picking up styles "C-Heading 4" and "C-Table
Step 3."
All of the "C-Heading" styles are based on to C-Heading 1 as part of an
outline numbering scheme. The "C-Table" styles are based on the C-Heading
styles of the same number and are then modified (for example, C-Table Step 3
is based on C-Heading 3).
How can I modify the code to prevent it from picking up C-Heading 4 and
C-Table Step 3 in the TOC?
With ActiveDocument
.TablesOfContents.Add _
Range:=Selection.Range, _
RightAlignPageNumbers:=True, _
UseHeadingStyles:=False, _
IncludePageNumbers:=True, _
AddedStyles:="C-Heading 1,1,C-Heading 2,2,C-Heading 3,3,C-Table
Step 2,2", _
UseHyperlinks:=True, _
HidePageNumbersInWeb:=True, _
UseOutlineLevels:=False
.TablesOfContents(1).TabLeader = wdTabLeaderSpaces
.TablesOfContents.Format = wdIndexIndent
End With
TIA, Vivian