Range.Previous Method (Word)

Office 2013 and later
GitHub-Mark-64px

Contribute to this content

Use GitHub to suggest and submit changes. See our guidelines for contributing to VBA documentation.

Returns the previous range a relative to the specified range.

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

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.

ActiveDocument.Words(2).Previous(Unit:=wdWord, Count:=1).Select

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

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

Concepts

Other resources

Show: