UpperHeadingLevel Property Example
This example formats the first table of contents in the active document to compile all headings that are formatted with either the Heading 2 or Heading 3 style.
If ActiveDocument.TablesOfContents.Count >= 1 Then
With ActiveDocument.TablesOfContents(1)
.UseHeadingStyles = True
.UseFields = False
.UpperHeadingLevel = 2
.LowerHeadingLevel = 3
End With
End If