TableOfContents Object
Description
Represents a single table of contents in a document. The TableOfContents object is a member of the TablesOfContents collection. The TablesOfContents collection includes all the tables of contents in a document.
Using the TableOfContents Object
Use TablesOfContents(index), where index is the index number, to return a single TableOfContents object. The index number represents the position of the table of contents in the document. The following example updates the page numbers of the items in the first table of figures in the active document.
ActiveDocument.TablesOfContents(1).UpdatePageNumbers
Use the Add method to add a table of contents to a document. The following example adds a table of contents at the beginning of the active document. The example builds the table of contents from all paragraphs styled as either Heading 1, Heading 2, or Heading 3.
Set myRange = ActiveDocument.Range(Start:=0, End:=0)
ActiveDocument.TablesOfContents.Add Range:=myRange, _
UseFields:=False, UseHeadingStyles:=True, LowerHeadingLevel:=3, _
UpperHeadingLevel:=1
Properties
Application property, Creator property, HeadingStyles property, IncludePageNumbers property, LowerHeadingLevel property, Parent property, Range property, RightAlignPageNumbers property, TabLeader property, TableID property, UpperHeadingLevel property, UseFields property, UseHeadingStyles property.
Methods
Delete method, Update method, UpdatePageNumbers method.
See Also
TableOfFigures object.