TextStyles.Add method (Publisher)
Adds a new TextStyle object to the specified TextStyles collection and returns the new TextStyle object.
Syntax
expression.Add (StyleName, Font, ParagraphFormat, BasedOn)
expression A variable that represents a TextStyles object.
Parameters
Name | Required/Optional | Data type | Description |
---|---|---|---|
StyleName | Required | String | The name of the new text style. If the name matches an existing text style, the existing text style is overwritten. |
Font | Optional | Font | The font settings to apply to the new text style. |
ParagraphFormat | Optional | ParagraphFormat | The paragraph formatting to apply to the new text style. |
BasedOn | Optional | String | The name of the text style on which the new text style is based. If the name does not match an existing text style, an error occurs. |
Return value
TextStyle
Example
The following example adds a new text style to the active publication based on the Normal text style.
Dim tsNew As TextStyle
Set tsNew = ActiveDocument.TextStyles _
.Add(StyleName:="Title", BasedOn:="Normal")
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.