Range.MoveStart Method (Word)

Moves the start position of the specified range.

Syntax

expression .MoveStart(Unit, Count)

expression Required. A variable that represents a Range object.

Parameters

Name

Required/Optional

Data Type

Description

Unit

Optional

WdUnits

The unit by which start position of the specified range is to be moved.

Count

Optional

Variant

The maximum number of units by which the specified range is to be moved. If Count is a positive number, the start position of the range is moved forward in the document. If it is a negative number, the start position is moved backward. If the start position is moved forward to a position beyond the end position, the range is collapsed and both the start and end positions are moved together. The default value is 1.

Return Value

Integer

Remarks

This method returns an integer that indicates the number of units by which the start position or the range actually moved, or it returns 0 (zero) if the move was unsuccessful.

Example

This example sets myRange to be equal to the second word in the active document. The example uses the MoveStart method to move the start position of myRange (a Range object) backward one word. After this macro is run, the first and second words in the document are selected.

If ActiveDocument.Words.Count >= 2 Then 
 Set myRange = ActiveDocument.Words(2) 
 With myRange 
 .MoveStart Unit:=wdWord, Count:=-1 
 .Select 
 End With 
End If

See Also

Concepts

Range Object Members

Range Object