Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

double spacing an indetermined length TOC 1

Status
Not open for further replies.

lemonhalls

Technical User
Jun 11, 2004
52
CA
Hi all,

I'm a newbie at programming and am not sure how to change the spacing within my TOC to 1.5 pt.

I have this code that changes only the first 4 paragraphs
Set myRange = ActiveDocument.Range( _
Start:=ActiveDocument.Paragraphs(1).Range.Start, _
End:=ActiveDocument.Paragraphs(4).Range.End)
myRange.paragraphFormat.LineSpacingRule = wdLineSpace1pt5

but because my TOC is dependant on the content of the document, I do not know how many paragraphs nor pages the TOC will be.

Currently, the TOC starts at the second page. It is a one pager, but it may grow to be a two pager. This is my code for the TOC

With ActiveDocument
.TablesOfContents.Add Range:=Selection.Range, RightAlignPageNumbers:= _
True, UseHeadingStyles:=True, UpperHeadingLevel:=3, LowerHeadingLevel:=3, _
IncludePageNumbers:=True, AddedStyles:="Heading 3", _
UseHyperlinks:=True, HidePageNumbersInWeb:= _
True, UseOutlineLevels:=False
.TablesOfContents(1).TabLeader = wdTabLeaderDots
.TablesOfContents.Format = wdIndexIndent
End With

What should I select in the paragraphFormat statement to ensure the content within the TOC is spaced at 1.5 pt? Is it the active page?? number of lines in the TOC?? Or can I incorporate it within the TOC code?

Many thanks,

S
 
Have you tried to play with the .TablesOfContents.Range.Paragraphs collection ?

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
I tried the following but got these error messages...

with ActiveDocument.TablesOfContents.Range.Paragraphs.Select
compile error: method or data member not found (highlighting Range)

with ActiveDocument.Tables(1).Range.Paragraphs.Select
compile error: method or data member not found (highlighting select)

hm.. not sure how to apply the tableOfContents.Range.Paragraphs, please advice.

thanks,

S


 
Sorry for the typo. Have you tried this ?
ActiveDocument.TablesOfContents(1).Range.ParagraphFormat.LineSpacingRule = wdLineSpace1pt5

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top