Share via


HeadingStyle Object

Word Developer Reference

Represents a style used to build a table of contents or figures. The HeadingStyle object is a member of the HeadingStyles collection.

Remarks

Use HeadingStyles(Index), where Index is the index number, to return a single HeadingStyle object. The index number represents the position of the style in the HeadingStyles collection. The following example adds (at the beginning of the active document) a table of figures built from the Title style, and then displays the name of the first style in the HeadingStyles collection.

Visual Basic for Applications
  Set myTOF = ActiveDocument.TablesOfFigures.Add _
    (Range:=ActiveDocument.Range(0, 0), AddedStyles:="Title")
MsgBox myTOF.HeadingStyles(1).Style

Use the Add method to add a style to the HeadingStyles collection. The following 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.

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

See Also