Table of Contents Nightmare

J

JMS

Please can somebody help me... I am trying to create a Table of Contents to
include specific styles, however when I run the code it includes Heading
Styles 1 - 3 as well as the specified styles. I am using the following
command:

With ActiveDocument
.TablesOfContents.Add Range:=Selection.Range, RightAlignPageNumbers:= _
True, UseHeadingStyles:=False, IncludePageNumbers:=True, AddedStyles _
:= _
"Sch main head,1,Sch part head,2,Sch (1style) clause,3,Sch main
head single,1" _
, UseHyperlinks:=True, HidePageNumbersInWeb:=True, UseOutlineLevels _
:=True
.TablesOfContents(1).TabLeader = wdTabLeaderDots
.TablesOfContents.Format = wdIndexIndent
End With

I would like to get to a result where:
"Sch main head" Uses TOC Level 1
"Sch main head single" Uses TOC Level 1
"Sch part head" Uses TOC Level 2
"Sch (1style) clause" Uses TOC Level 3

The code has set UseHeadingStyles:=False but it seems to be ignoring it.

Can anybody help me.

Many thanks

Jon
 
C

CJ

Why don't you rework the built in heading styles to be formatted like the
ones you created and then just use them? Lots less work.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Table of Contents Styles font issue 5
Table of Content 1
TOC problem 0
TOC Help 0
TOC Problem 0
TOC Question 3
Apply a paragraph style to a Table of Contents 1
TOC is picking up extra styles 6

Top