Styles.Add method (Word)
Creates a new user-defined style and adds it to the Styles collection.
Syntax
expression.Add (Name, Type)
expression Required. A variable that represents a Styles object.
Parameters
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. |
Return value
Style
Example
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"
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.