Add Method (Styles Collection)

Applies To

Styles collection object.

Description

Adds a new user-defined style to the collection of styles.

Syntax

expression.Add(Name, Type)

expression Required. An expression that returns a Styles object.

Name Required String. The string name for the new style.

Type Optional Variant. The style type of the new style. Can be either of the following WdStyleType constants: wdStyleTypeParagraph or wdStyleTypeCharacter.

Example

This example adds a new character style named "Introduction" and makes it 12-point Arial, with bold and italic formatting. The example then applies the new character style to the selection.

Set myStyle = ActiveDocument.Styles.Add(Name:="Introduction", _
    Type:=wdStyleTypeCharacter)
With myStyle.Font
    .Bold = True
    .Italic = True
    .Name = "Arial"
    .Size = 12
End With
Selection.Range.Style = "Introduction"