Compartilhar via


Paragraph.Style Property

Word Developer Reference

Returns or sets the style for the specified object. Read/write Variant.

Syntax

expression.Style

expression   Required. A variable that represents a Paragraph object.

Remarks

To set this property, specify the local name of the style, an integer, a WdBuiltinStyle constant, or an object that represents the style.

Example

This example displays the style for each paragraph in the active document.

Visual Basic for Applications
  For Each para in ActiveDocument.Paragraphs
    MsgBox para.Style
Next para

This example sets alternating styles of Heading 3 and Normal for all the paragraphs in the active document.

Visual Basic for Applications
  For i = 1 To ActiveDocument.Paragraphs.Count
    If i Mod 2 = 0 Then
        ActiveDocument.Paragraphs(i).Style = wdStyleNormal
    Else: ActiveDocument.Paragraphs(i).Style = wdStyleHeading3
    End If
Next i

See Also