Level Property

Applies To

HeadingStyle object, Subdocument object.

Description

HeadingStyle object: Returns or sets the level for the heading style in a table of contents or table of figures. Read/write Long.

Subdocument object: Returns the heading level used to create the subdocument. Read-only Long.

See Also

HeadingStyles property, LowerHeadingLevel property, Subdocuments collection object, TablesOfContents collection object, TablesOfFigures collection object, UpperHeadingLevel property, UseHeadingStyles property.

Example

This example adds a table of contents at the insertion point in the active document, and then it changes the levels for the heading styles.

ActiveDocument.TablesOfContents.Add _
    Range:=Selection.Range, _
    RightAlignPageNumbers:=True, _
    UseHeadingStyles:=True, _ 
    UpperHeadingLevel:=1, _
    LowerHeadingLevel:=3, _
    IncludePageNumbers:=True, _
    TableID:=wdTOCFormal
With ActiveDocument.TablesOfContents(1).HeadingStyles
    .Add Style:="Title", Level:=1
    .Add Style:="SubTitle", Level:=2
    .Add Style:="List Bullet", Level:=3
End With
With ActiveDocument.TablesOfContents(1)
    .HeadingStyles(1).Level = 2
    .HeadingStyles(2).Level = 4
    .HeadingStyles(3).Level = 6
End With
This example looks through each subdocument in the active document and displays the subdocument's heading level.

i = 1
If ActiveDocument.Subdocuments.Count > = 1 Then
    For each s in ActiveDocument.Subdocuments
        MsgBox "The heading level for SubDoc " & i & " is " & s.Level
        i = i + 1
    Next s
Else
    MsgBox "There are no subdocuments defined."
End If