Styles.Add method (Word)
Creates a new user-defined style and adds it to the Styles collection.
expression.Add (Name, Type)
expression Required. A variable that represents a Styles object.
Name | Required/Optional | Data type | Description |
---|---|---|---|
Name | Required | String | The new style name. |
Type | Optional | WdStyleType | Can be one of the WdStyleType constants. The default is paragraph style. |
Style
The following example adds a new character style named "Introduction" and makes it 12-point Arial, with bold and italic formatting. The example then applies this 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"
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.