BaseStyle Property

Microsoft Word Visual Basic

BaseStyle Property

       

Returns or sets an existing style on which you can base the formatting of another style. To set this property, specify either the local name of the base style, an integer or a WdBuiltinStyle constant, or an object that represents the base style. Read/write Variant.

For a list of the WdBuiltinStyle constants, see the Style property.

Example

This example creates a new document and then adds a new paragraph style named "myHeading." It assigns Heading 1 as the base style for the new style . A left indent of 1 inch (72 points) is then specified for the new style.

Dim docNew As Document
Dim styleNew As Style

Set docNew = Documents.Add
Set styleNew = docNew.Styles.Add("NewHeading1")
With styleNew
    .BaseStyle = docNew.Styles(wdStyleHeading1)
    .ParagraphFormat.LeftIndent = 72
End With

This example returns the base style that's used for the Body Text paragraph style.

Dim styleBase As Style

styleBase = ActiveDocument.Styles(wdStyleBodyText).BaseStyle
MsgBox styleBase