HeadingStyles Property Example
This example adds a style to the HeadingStyles collection and then displays the names of all the style in the collection.
If ActiveDocument.TablesOfContents.Count >=1 Then
ActiveDocument.TablesOfContents(1).HeadingStyles.Add _
Style:="Title", Level:=2
For Each hStyle In _
ActiveDocument.TablesOfContents(1).HeadingStyles
MsgBox hStyle.Style
Next hStyle
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