Previous Property

Microsoft Word Visual Basic

Previous Property

       

Returns the previous object in the collection. Read-only.

Example

This example sets the space-before and space-after formatting for the paragraph immediately preceding the selection.

Set myPara = Selection.Paragraphs(1).Previous
With myPara
    .SpaceAfter = 12
    .SpaceBefore = 6
End With

If the selection is in a table, this example selects the contents of the previous row.

If Selection.Information(wdWithInTable) = True Then
    Selection.Rows(1).Previous.Select
End If

This example displays the field code of the second-to-last field in the active document.

Set aField = ActiveDocument _
    .Fields(ActiveDocument.Fields.Count).Previous
MsgBox "Field code = " & aField.Code