Style Property

Applies To

Find object, HeadingStyle object, LineFormat object, Paragraph object, ParagraphFormat object, Paragraphs collection object, Range object, Replacement object, Selection object.

Description

Returns or sets the style for the specified object. To set this property, specify either the local name of the style, an integer or a WdBuiltinStyle constant (see "Remarks"), or an object that represents the style. Read/write Variant.

Remarks

When you return the style for a range that includes more than one style, only the first character or paragraph style is returned.

The Style property can be one of the following WdBuiltinStyle constants:

  • wdStyleBlockQuotation
  • wdStyleBodyText
  • wdStyleBodyText2
  • wdStyleBodyText3
  • wdStyleBodyTextFirstIndent
  • wdStyleBodyTextFirstIndent2
  • wdStyleBodyTextIndent
  • wdStyleBodyTextIndent2
  • wdStyleBodyTextIndent3
  • wdStyleCaption
  • wdStyleClosing
  • wdStyleCommentReference

  • wdStyleCommentText
  • wdStyleDate
  • wdStyleDefaultParagraphFont
  • wdStyleEmphasis
  • wdStyleEndnoteReference
  • wdStyleEndnoteText
  • wdStyleEnvelopeAddress
  • wdStyleEnvelopeReturn
  • wdStyleFooter
  • wdStyleFootnoteReference
  • wdStyleFootnoteText
  • wdStyleHeader
  • wdStyleHeading1
  • wdStyleHeading2
  • wdStyleHeading3
  • wdStyleHeading4
  • wdStyleHeading5
  • wdStyleHeading6
  • wdStyleHeading7
  • wdStyleHeading8
  • wdStyleHeading9
  • wdStyleHyperlink
  • wdStyleHyperlinkFollowed
  • wdStyleIndex1
  • wdStyleIndex2
  • wdStyleIndex3
  • wdStyleIndex4
  • wdStyleIndex5
  • wdStyleIndex6
  • wdStyleIndex7
  • wdStyleIndex8
  • wdStyleIndex9
  • wdStyleIndexHeading
  • wdStyleLineNumber
  • wdStyleList
  • wdStyleList2
  • wdStyleList3
  • wdStyleList4
  • wdStyleList5
  • wdStyleListBullet
  • wdStyleListBullet2
  • wdStyleListBullet3
  • wdStyleListBullet4
  • wdStyleListBullet5
  • wdStyleListContinue
  • wdStyleListContinue2
  • wdStyleListContinue3
  • wdStyleListContinue4
  • wdStyleListContinue5
  • wdStyleListNumber
  • wdStyleListNumber2
  • wdStyleListNumber3
  • wdStyleListNumber4
  • wdStyleListNumber5
  • wdStyleMacroText
  • wdStyleMessageHeader
  • wdStyleNavPane
  • wdStyleNormal
  • wdStyleNormalIndent
  • wdStyleNoteHeading
  • wdStylePageNumber
  • wdStylePlainText
  • wdStyleSalutation
  • wdStyleSignature
  • wdStyleStrong
  • wdStyleSubtitle
  • wdStyleTableOfAuthorities
  • wdStyleTableOfFigures
  • wdStyleTitle
  • wdStyleTOAHeading
  • wdStyleTOC1
  • wdStyleTOC2

  • wdStyleTOC3
  • wdStyleTOC4
  • wdStyleTOC5
  • wdStyleTOC6
  • wdStyleTOC7
  • wdStyleTOC8
  • wdStyleTOC9

See Also

AutoFormat method, Styles property.

Example

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

For Each para in ActiveDocument.Paragraphs
    MsgBox para.Style
Next para
This example displays the style for each character in the selection. Each element of the Characters collection is a Range object.

For each c in Selection.Characters
    MsgBox c.Style
Next c
This example sets alternating styles of Heading 3 and Normal for all the paragraphs in the active document.

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
This example finds all instances of the Heading 1 style in the active document and replaces them with the Heading 2 style.

With ActiveDocument.Content.Find
    .ClearFormatting
    .Style = wdStyleHeading1
    .Replacement.ClearFormatting
    .Replacement.Style = wdStyleHeading2
    .Execute FindText:="", ReplaceWith:="", _
        Replace:=wdReplaceAll, Format:=True
End With