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

Re: TOC is picking up extra styles by Chad

Chad
Mon Aug 30 10:50:21 CDT 2004

Vivian,

How about something like this:

ActiveDocument.Fields.Add Range:=Selection.Range, Type:=wdFieldEmpty, _
Text:="TOC \t "C-Heading 1,1,C-Heading 2,2,C-Table Step 2,2, C-Heading
3,3 \z \h"

Regards,
Chad


"Vivian Carroll" <vcvc@aol.com> wrote in message
news:%23ClEsXhjEHA.3896@TK2MSFTNGP15.phx.gbl...
> 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
>
>



Re: TOC is picking up extra styles by Chad

Chad
Mon Aug 30 11:01:16 CDT 2004

I noticed some errors with regards to quotation marks when reading my
original post:

ActiveDocument.Fields.Add Range:=Selection.Range, Type:=wdFieldEmpty, _
Text:="TOC \t ""C-Heading 1,1,C-Heading 2,2,C-Table Step 2,2, C-Heading
3,3"" \z \h"

Regards,
Chad


"Chad DeMeyer" <cjdemeye at bechtel dot com> wrote in message
news:%23cjcPkqjEHA.1040@TK2MSFTNGP09.phx.gbl...
> Vivian,
>
> How about something like this:
>
> ActiveDocument.Fields.Add Range:=Selection.Range, Type:=wdFieldEmpty, _
> Text:="TOC \t "C-Heading 1,1,C-Heading 2,2,C-Table Step 2,2, C-Heading
> 3,3 \z \h"
>
> Regards,
> Chad
>
>
> "Vivian Carroll" <vcvc@aol.com> wrote in message
> news:%23ClEsXhjEHA.3896@TK2MSFTNGP15.phx.gbl...
> > 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
> >
> >
>
>



Re: TOC is picking up extra styles - need more help by Vivian

Vivian
Mon Aug 30 21:32:06 CDT 2004

Thanks Chad,

That did half of the job - it stopped it from picking up C-Heading 4.
However, it is still picking up the level 3 heading called C-Table Step 3
that I don't want. Is there any way to stop that or does the TOC always pick
up all styles at the outline levels that you specify to show (3 in my case)?

What do the \t, \z and \h switches do?

Vivian



"Chad DeMeyer" <cjdemeye at bechtel dot com> wrote in message
news:OB0FWqqjEHA.3392@TK2MSFTNGP15.phx.gbl...
> I noticed some errors with regards to quotation marks when reading my
> original post:
>
> ActiveDocument.Fields.Add Range:=Selection.Range, Type:=wdFieldEmpty, _
> Text:="TOC \t ""C-Heading 1,1,C-Heading 2,2,C-Table Step 2,2,
C-Heading
> 3,3"" \z \h"
>
> Regards,
> Chad
>
>
> "Chad DeMeyer" <cjdemeye at bechtel dot com> wrote in message
> news:%23cjcPkqjEHA.1040@TK2MSFTNGP09.phx.gbl...
> > Vivian,
> >
> > How about something like this:
> >
> > ActiveDocument.Fields.Add Range:=Selection.Range, Type:=wdFieldEmpty, _
> > Text:="TOC \t "C-Heading 1,1,C-Heading 2,2,C-Table Step 2,2,
C-Heading
> > 3,3 \z \h"
> >
> > Regards,
> > Chad
> >
> >
> > "Vivian Carroll" <vcvc@aol.com> wrote in message
> > news:%23ClEsXhjEHA.3896@TK2MSFTNGP15.phx.gbl...
> > > 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
> > >
> > >
> >
> >
>
>



Re: TOC is picking up extra styles - need more help by Chad

Chad
Tue Aug 31 09:36:11 CDT 2004

Vivian,

\t always followed by a string argument, which lists specific styles to
includes in the TOC and what level to include them at
e.g., "Title,1,Subtitle,2"
\z Hide page numbers in web layout
\h Use hyperlinks

\o Include all styles which are defined as being in the outline levels
specified by the argument - so yes, \o "1-3" will cause C-Table Step 3 to be
picked up in the TOC, because (I assume) that style is marked as outline
Level 3 in its style definition. I almost never use the \o switch - I
prefer to explicitly list a few styles with the \t switch.

Hope that helps
Regards,
Chad


"Vivian Carroll" <vcvc@aol.com> wrote in message
news:uc$J5KwjEHA.1764@TK2MSFTNGP10.phx.gbl...
> Thanks Chad,
>
> That did half of the job - it stopped it from picking up C-Heading 4.
> However, it is still picking up the level 3 heading called C-Table Step 3
> that I don't want. Is there any way to stop that or does the TOC always
pick
> up all styles at the outline levels that you specify to show (3 in my
case)?
>
> What do the \t, \z and \h switches do?
>
> Vivian
>
>
>
> "Chad DeMeyer" <cjdemeye at bechtel dot com> wrote in message
> news:OB0FWqqjEHA.3392@TK2MSFTNGP15.phx.gbl...
> > I noticed some errors with regards to quotation marks when reading my
> > original post:
> >
> > ActiveDocument.Fields.Add Range:=Selection.Range, Type:=wdFieldEmpty, _
> > Text:="TOC \t ""C-Heading 1,1,C-Heading 2,2,C-Table Step 2,2,
> C-Heading
> > 3,3"" \z \h"
> >
> > Regards,
> > Chad
> >
> >
> > "Chad DeMeyer" <cjdemeye at bechtel dot com> wrote in message
> > news:%23cjcPkqjEHA.1040@TK2MSFTNGP09.phx.gbl...
> > > Vivian,
> > >
> > > How about something like this:
> > >
> > > ActiveDocument.Fields.Add Range:=Selection.Range, Type:=wdFieldEmpty,
_
> > > Text:="TOC \t "C-Heading 1,1,C-Heading 2,2,C-Table Step 2,2,
> C-Heading
> > > 3,3 \z \h"
> > >
> > > Regards,
> > > Chad
> > >
> > >
> > > "Vivian Carroll" <vcvc@aol.com> wrote in message
> > > news:%23ClEsXhjEHA.3896@TK2MSFTNGP15.phx.gbl...
> > > > 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
> > > >
> > > >
> > >
> > >
> >
> >
>
>



Re: TOC is picking up extra styles - need more help by Vivian

Vivian
Wed Sep 01 08:18:06 CDT 2004

Thanks for the switch descriptions, Chad.

However, you say why not to use \o and you didn't use \o in the code you
gave me - but it is still picking up C-Table Step 3 (which is marked as
outline Level 3) even though you/I didn't use the \o switch. So what can I
do to say "don't include C-Table Step 3"?

Vivian

"Chad DeMeyer" <cjdemeye at bechtel dot com> wrote in message
news:Omtadf2jEHA.644@tk2msftngp13.phx.gbl...
> Vivian,
>
> \t always followed by a string argument, which lists specific styles to
> includes in the TOC and what level to include them at
> e.g., "Title,1,Subtitle,2"
> \z Hide page numbers in web layout
> \h Use hyperlinks
>
> \o Include all styles which are defined as being in the outline levels
> specified by the argument - so yes, \o "1-3" will cause C-Table Step 3 to
be
> picked up in the TOC, because (I assume) that style is marked as outline
> Level 3 in its style definition. I almost never use the \o switch - I
> prefer to explicitly list a few styles with the \t switch.
>
> Hope that helps
> Regards,
> Chad
>
>
> "Vivian Carroll" <vcvc@aol.com> wrote in message
> news:uc$J5KwjEHA.1764@TK2MSFTNGP10.phx.gbl...
> > Thanks Chad,
> >
> > That did half of the job - it stopped it from picking up C-Heading 4.
> > However, it is still picking up the level 3 heading called C-Table Step
3
> > that I don't want. Is there any way to stop that or does the TOC always
> pick
> > up all styles at the outline levels that you specify to show (3 in my
> case)?
> >
> > What do the \t, \z and \h switches do?
> >
> > Vivian
> >
> >
> >
> > "Chad DeMeyer" <cjdemeye at bechtel dot com> wrote in message
> > news:OB0FWqqjEHA.3392@TK2MSFTNGP15.phx.gbl...
> > > I noticed some errors with regards to quotation marks when reading my
> > > original post:
> > >
> > > ActiveDocument.Fields.Add Range:=Selection.Range, Type:=wdFieldEmpty,
_
> > > Text:="TOC \t ""C-Heading 1,1,C-Heading 2,2,C-Table Step 2,2,
> > C-Heading
> > > 3,3"" \z \h"
> > >
> > > Regards,
> > > Chad
> > >
> > >
> > > "Chad DeMeyer" <cjdemeye at bechtel dot com> wrote in message
> > > news:%23cjcPkqjEHA.1040@TK2MSFTNGP09.phx.gbl...
> > > > Vivian,
> > > >
> > > > How about something like this:
> > > >
> > > > ActiveDocument.Fields.Add Range:=Selection.Range,
Type:=wdFieldEmpty,
> _
> > > > Text:="TOC \t "C-Heading 1,1,C-Heading 2,2,C-Table Step 2,2,
> > C-Heading
> > > > 3,3 \z \h"
> > > >
> > > > Regards,
> > > > Chad
> > > >
> > > >
> > > > "Vivian Carroll" <vcvc@aol.com> wrote in message
> > > > news:%23ClEsXhjEHA.3896@TK2MSFTNGP15.phx.gbl...
> > > > > 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
> > > > >
> > > > >
> > > >
> > > >
> > >
> > >
> >
> >
>
>



Re: TOC is picking up extra styles - need more help by Chad

Chad
Wed Sep 01 09:41:16 CDT 2004

Vivian,

Sorry, that's a head scratcher. If you want to send me the document, I can
play around with it and see if I can figure it out?

Regards,
Chad

"Vivian Carroll" <vcvc@aol.com> wrote in message
news:O7NogYCkEHA.1040@TK2MSFTNGP10.phx.gbl...
> Thanks for the switch descriptions, Chad.
>
> However, you say why not to use \o and you didn't use \o in the code you
> gave me - but it is still picking up C-Table Step 3 (which is marked as
> outline Level 3) even though you/I didn't use the \o switch. So what can I
> do to say "don't include C-Table Step 3"?
>
> Vivian
>
> "Chad DeMeyer" <cjdemeye at bechtel dot com> wrote in message
> news:Omtadf2jEHA.644@tk2msftngp13.phx.gbl...
> > Vivian,
> >
> > \t always followed by a string argument, which lists specific styles
to
> > includes in the TOC and what level to include them at
> > e.g., "Title,1,Subtitle,2"
> > \z Hide page numbers in web layout
> > \h Use hyperlinks
> >
> > \o Include all styles which are defined as being in the outline
levels
> > specified by the argument - so yes, \o "1-3" will cause C-Table Step 3
to
> be
> > picked up in the TOC, because (I assume) that style is marked as outline
> > Level 3 in its style definition. I almost never use the \o switch - I
> > prefer to explicitly list a few styles with the \t switch.
> >
> > Hope that helps
> > Regards,
> > Chad
> >
> >
> > "Vivian Carroll" <vcvc@aol.com> wrote in message
> > news:uc$J5KwjEHA.1764@TK2MSFTNGP10.phx.gbl...
> > > Thanks Chad,
> > >
> > > That did half of the job - it stopped it from picking up C-Heading 4.
> > > However, it is still picking up the level 3 heading called C-Table
Step
> 3
> > > that I don't want. Is there any way to stop that or does the TOC
always
> > pick
> > > up all styles at the outline levels that you specify to show (3 in my
> > case)?
> > >
> > > What do the \t, \z and \h switches do?
> > >
> > > Vivian
> > >
> > >
> > >
> > > "Chad DeMeyer" <cjdemeye at bechtel dot com> wrote in message
> > > news:OB0FWqqjEHA.3392@TK2MSFTNGP15.phx.gbl...
> > > > I noticed some errors with regards to quotation marks when reading
my
> > > > original post:
> > > >
> > > > ActiveDocument.Fields.Add Range:=Selection.Range,
Type:=wdFieldEmpty,
> _
> > > > Text:="TOC \t ""C-Heading 1,1,C-Heading 2,2,C-Table Step 2,2,
> > > C-Heading
> > > > 3,3"" \z \h"
> > > >
> > > > Regards,
> > > > Chad
> > > >
> > > >
> > > > "Chad DeMeyer" <cjdemeye at bechtel dot com> wrote in message
> > > > news:%23cjcPkqjEHA.1040@TK2MSFTNGP09.phx.gbl...
> > > > > Vivian,
> > > > >
> > > > > How about something like this:
> > > > >
> > > > > ActiveDocument.Fields.Add Range:=Selection.Range,
> Type:=wdFieldEmpty,
> > _
> > > > > Text:="TOC \t "C-Heading 1,1,C-Heading 2,2,C-Table Step 2,2,
> > > C-Heading
> > > > > 3,3 \z \h"
> > > > >
> > > > > Regards,
> > > > > Chad
> > > > >
> > > > >
> > > > > "Vivian Carroll" <vcvc@aol.com> wrote in message
> > > > > news:%23ClEsXhjEHA.3896@TK2MSFTNGP15.phx.gbl...
> > > > > > 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
> > > > > >
> > > > > >
> > > > >
> > > > >
> > > >
> > > >
> > >
> > >
> >
> >
>
>