ParagraphFormat Property

Microsoft Word Visual Basic

Returns or sets a ParagraphFormat object that represents the paragraph settings for the specified range, selection, find or replacement operation, or style. Read/write.

Example

This example sets the paragraph formatting for the current selection to be right-aligned.

Selection.ParagraphFormat.Alignment = wdAlignParagraphRight
		

This example sets paragraph formatting for a range that includes the entire contents of MyDoc.doc. Paragraphs in this document are double-spaced and have a custom tab stop at 0.25 inch.

Set myRange = Documents("MyDoc.doc").Content
With myRange.ParagraphFormat
    .Space2
    .TabStops.Add Position:=InchesToPoints(.25)
End With
		

This example modifies the Heading 2 style for the active document. Paragraphs formatted with this style are indented to the first tab stop and double-spaced.

With ActiveDocument.Styles(wdStyleHeading2).ParagraphFormat
    .TabIndent(1)
    .Space2
End With
		

This example finds all double-spaced paragraphs in the active document and replaces the formatting with 1.5-line spacing.

With ActiveDocument.Content.Find
    .ClearFormatting
    .ParagraphFormat.Space2
    .Replacement.ClearFormatting
    .Replacement.ParagraphFormat.Space15
    .Execute FindText:="", ReplaceWith:="", _
        Replace:=wdReplaceAll
End With