UseHeadingStyles Property

Microsoft Word Visual Basic

UseHeadingStyles Property

       

True if built-in heading styles are used to create a table of contents or a table of figures. Read/write Boolean.

expression.UseHeadingStyles

expression   Required. An expression that returns one of the objects in the Applies To list.

Example

This example formats the first table of contents in the active document to compile entries formatted with the Heading 1, Heading 2, or Heading 3 style.

If ActiveDocument.TablesOfContents.Count >= 1 Then
    With ActiveDocument.TablesOfContents(1)
        .UseHeadingStyles = True
        .UseFields = False
        .UpperHeadingLevel = 1
        .LowerHeadingLevel = 3
    End With
End If

This example adds a table of figures in place of the selection and then formats the table to compile entries from TC fields.

With ActiveDocument.TablesOfFigures.Add(Range:=Selection.Range)
    .UseHeadingStyles = False
    .UseFields = True
End With