Compartilhar via


Style.LinkStyle Property

Word Developer Reference

Sets or returns a Variant that represents a link between a paragraph and a character style. Read/write.

Syntax

expression.LinkStyle

expression   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.

Visual Basic for Applications
  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").<strong class="bterm">LinkStyle</strong> = _
    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

See Also