LinkStyle Property

Microsoft Word Visual Basic

expression.LinkStyle

expression    Required. An expression that returns a Style object.

Remarks

When a character style and a paragraph style are linked, the two styles take on the same character formatting.

Example

This example creates and formats a new character style, and then it links the character style to the built-in heading style "Heading 1" so that the "Heading 1" style takes on the character formatting of the newly added style.

Sub LinkHeadStyle()
    Dim styChar1 As Style

    Set styChar1 = ActiveDocument.Styles.Add(Name:="Heading 1 Characters", _
        Type:=wdStyleTypeCharacter)
        With styChar1
            .Font.Name = "Verdana"
            .Font.Bold = True
            .Font.Shadow = True
            With .Font.Borders(1)
                .LineStyle = wdLineStyleDot
                .LineWidth = wdLineWidth300pt
                .Color = wdColorDarkRed
            End With
        End With
    ActiveDocument.Styles("Heading 1").LinkStyle = ActiveDocument _
        .Styles("Heading 1 Characters")

    With ActiveDocument.Content
        .InsertParagraphAfter
        .InsertAfter "New Linked Style"
        .Select
    End With

    Selection.Collapse Direction:=wdCollapseEnd
    Selection.Style = ActiveDocument.Styles("Heading 1")

End Sub