TableOfContents.HeadingStyles property (Word)
Returns a HeadingStyles object that represents additional styles used to compile a table of contents or table of figures (styles other than the Heading 1 - Heading 9 styles). Read-only.
Syntax
expression. HeadingStyles
expression A variable that represents a 'TableOfContents' collection.
Example
This example adds a style to the HeadingStyles collection and then displays the names of all the style in the collection.
Dim hsLoop As HeadingStyle
If ActiveDocument.TablesOfContents.Count >=1 Then
ActiveDocument.TablesOfContents(1).HeadingStyles.Add _
Style:="Title", Level:=2
For Each hsLoop In _
ActiveDocument.TablesOfContents(1).HeadingStyles
MsgBox hsLoop.Style
Next hsLoop
End If
This example adds a style named "Blue" to the HeadingStyles collection in a table of contents for Sales.doc.
With Documents("Sales.doc")
.Styles.Add Name:="Blue"
.TablesOfContents(1).UseHeadingStyles = True
.TablesOfContents(1).HeadingStyles.Add _
Style:="Blue", Level:=4
End With
See also
Support and feedback
Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.