F
Fred
Hello,
I'm trying to make a macro create a TOC, but I do not want
that TOC to use the normal Headings(Heading 1, through
Heading 9). Instead, I wish the TOC to use a particular
heading of my creation(It's called TOC). Creating the TOC
by hand is quite simple in word, and I can deselct the
Heading 1 through Heading 9, and have word only use my
created "TOC" heading, however, getting the macro to do it
isn't working. Thus far my code is this:
With ActiveDocument
.TablesOfContents.Add Range:=Selection.Range,
RightAlignPageNumbers:= _
True, AddedStyles _
:="TOC,1", LowerHeadingLevel:=1,
UpperHeadingLevel:=1, UseHeadingStyles:= _
False, IncludePageNumbers:=True,
UseHyperlinks:=True, HidePageNumbersInWeb:=True
.TablesOfContents(1).TabLeader = wdTabLeaderDots
.TablesOfContents.Format = wdIndexIndent
End With
What this does for me is create a TOC, but it ends up
listing out both my created heading "TOC", and Heading 1.
All I want to do is to get word to stop including the
Heading 1.
Any suggestions would be great.
Fred
I'm trying to make a macro create a TOC, but I do not want
that TOC to use the normal Headings(Heading 1, through
Heading 9). Instead, I wish the TOC to use a particular
heading of my creation(It's called TOC). Creating the TOC
by hand is quite simple in word, and I can deselct the
Heading 1 through Heading 9, and have word only use my
created "TOC" heading, however, getting the macro to do it
isn't working. Thus far my code is this:
With ActiveDocument
.TablesOfContents.Add Range:=Selection.Range,
RightAlignPageNumbers:= _
True, AddedStyles _
:="TOC,1", LowerHeadingLevel:=1,
UpperHeadingLevel:=1, UseHeadingStyles:= _
False, IncludePageNumbers:=True,
UseHyperlinks:=True, HidePageNumbersInWeb:=True
.TablesOfContents(1).TabLeader = wdTabLeaderDots
.TablesOfContents.Format = wdIndexIndent
End With
What this does for me is create a TOC, but it ends up
listing out both my created heading "TOC", and Heading 1.
All I want to do is to get word to stop including the
Heading 1.
Any suggestions would be great.
Fred