![]() |
#4
|
||||
|
||||
![]()
Your code doesn't work the way it should because it doesn't correspond to the way that Word works.
Looking at each line, this is where you are having problems Line 1 produces a field code that looks like this TOC \o "1-9" \h \z \t "Heading 1,Heading 2" So your Heading 1 and Heading 2 entries appear in the TOC because of the \o "1-9" part. Using the \t switch is superfluous in this case because those two styles are already in there. Also "Heading 1,1,Heading 2,2" is what is supposed to be in the quotes - you have to tell Word what TOC style to assign to each style. Line 2 doesn't align with how tab leaders work. .TablesOfContents(1).TabLeader = wdTabLeaderDots A tab leader is a property of a particular tab in a particular paragraph or style. In the context of an entire table of contents which could contain 9 styles and many paragraphs this line means nothing. Plus the first table of contents in a document may not actually BE the TOC that you just inserted in the first line (if there is another TOC earlier in the doc). Line 3 .TablesOfContents.Format = wdIndexIndent I have no idea of what you expected to happen with this line. wdIndexIndent is a built-in constant with a value of 0. What does it mean to set a "Format = 0" when Format might be typeface/font size/bold/italic/paragraph spacing/paragraph indent etc. And where are you trying to apply this 'formatting'?
__________________
Andrew Lockton Chrysalis Design, Melbourne Australia |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
![]() |
Pey1 | PowerPoint | 1 | 05-25-2016 02:15 AM |
Styles in a Custom Ribbon | inagalaxyfarfarawry | Word | 5 | 12-15-2015 11:18 AM |
Custom Bar Styles | dbsoccer | Project | 7 | 10-31-2013 07:26 AM |
creating new styles | hannu | Word | 8 | 04-28-2013 11:23 PM |
![]() |
Stone | Word | 2 | 09-11-2012 04:54 PM |