![]() |
|
|
|
#1
|
|||
|
|||
|
Or why don't you let Word use it own will to create the TOC and then use your will (aka macro) to make a table out of the TOC:
Code:
Sub ScratchMacro()
Dim oRng As Range
Dim oTbl As Table
Set oRng = Selection.Fields.Add(Selection.Range, wdFieldTOC).Result
oRng.Fields(1).Unlink
Set oTbl = oRng.ConvertToTable(vbTab)
With oTbl
.Rows.Add BeforeRow:=oTbl.Rows(1)
.Cell(1, 1).Range.Text = "Topic"
.Cell(1, 2).Range.Text = "See Page"
.Columns(2).Select
Selection.ParagraphFormat.Alignment = wdAlignParagraphRight
.Borders.OutsideLineStyle = wdLineStyleSingle
End With
oRng.Select
Selection.Collapse wdCollapseEnd
lbl_Exit:
Exit Sub
End Sub
|
|
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
Table of contents vs headings: what style settings need to be changed?
|
boxhamster | Word | 5 | 08-15-2015 03:25 PM |
| LaTeX style table of contents in MS Word | MichaelHenrotte | Word | 1 | 11-23-2014 03:16 AM |
Creating Table of Contents From a Custom Style
|
Jetheat | Word | 4 | 12-15-2013 03:54 PM |
| How to have this Heading – Table of contents style? | Jamal NUMAN | Word | 0 | 01-13-2011 06:02 PM |
| Word 2003 Table of Contents Error Message | ktcolburn | Word | 1 | 10-30-2005 06:14 PM |