Styles.Add Method (Word)

Returns a HeadingStyle object that represents a new heading style added to a document.

Syntax

expression .Add(Style, Level)

expression Required. A variable that represents a Styles collection.

Parameters

Name

Required/Optional

Data Type

Description

Style

Required

Variant

The style you want to add. You can specify this argument by using either the string name for the style or a Style object.

Level

Required

Integer

A number that represents the level of the heading.

Return Value

HeadingStyle

Remarks

The new heading style will be included whenever you compile a table of contents or table of figures.

Example

This 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.

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

See Also

Concepts

Styles Object Members

Styles Collection Object