Add Method (HeadingStyles Collection) Example

This example adds a table of contents at the beginning of the active document and then adds the Title style to the list of styles used to build a table of contents.

Set myToc = ActiveDocument.TablesOfContents _
    .Add(Range:=ActiveDocument.Range(0, 0), _
    UseHeadingStyles:=True, UpperHeadingLevel:=1, _
    LowerHeadingLevel:=3)
myToc.HeadingStyles.Add Style:="Title", Level:=2