Share via


Range.Previous Method

Word Developer Reference

Returns the previous range a relative to the specified range.

Syntax

expression.Previous(Unit, Count)

expression   Required. A variable that represents a Range object.

Parameters

Name Required/Optional Data Type Description
Unit Optional Variant The type of units by which to count. Can be any WdUnits constant.
Count Optional Variant The number of units by which you want to move back. The default value is 1.

Return Value
Range

Remarks

If the Range object is just after the specified Unit, the Range object is moved to the previous unit. For example, if the Range object is just after a word (before the trailing space), the following instruction moves the Range object backward to the previous word.

Visual Basic for Applications
  ActiveDocument.Words(2).Previous(Unit:=wdWord, Count:=1).Select

Example

This example applies bold formatting to the first word in the active document.

Visual Basic for Applications
  ActiveDocument.Words(2) _
    .Previous(Unit:=wdWord, Count:=1).Bold = True

See Also