Paragraphs Collection Object

Word Developer Reference

A collection of Paragraph objects in a selection, range, or document.

Remarks

Use the Paragraphs property to return the Paragraphs collection. The following example formats the selected paragraphs to be double-spaced and right-aligned.

Visual Basic for Applications
  With Selection.Paragraphs
    .Alignment = wdAlignParagraphRight
    .LineSpacingRule = wdLineSpaceDouble
End With

Use the Add, InsertParagraph, InsertParagraphAfter, or InsertParagraphBefore method to add a new paragraph to a document. The following example adds a new paragraph before the first paragraph in the selection.

Visual Basic for Applications
  Selection.Paragraphs.Add Range:=Selection.Paragraphs(1).Range

The following example also adds a paragraph before the first paragraph in the selection.

Visual Basic for Applications
  Selection.Paragraphs(1).Range.InsertParagraphBefore

Use Paragraphs(Index), where Index is the index number, to return a single Paragraph object. The following example right aligns the first paragraph in the active document.

Visual Basic for Applications
  ActiveDocument.Paragraphs(1).Alignment = wdAlignParagraphRight

The Count property for this collection in a document returns the number of items in the main story only. To count items in other stories use the collection with the Range object.

See Also