Move Method

See Also         Example         Applies To

Range or Selection object: Collapses the specified range or selection to its start position or end position and then moves the collapsed object by the specified number of units. This method returns a value that indicates the number of units by which the object was actually moved, or it returns 0 (zero) if the move was unsuccessful.

Application or Task object: Positions a task window or the active document window.

Syntax 1

expression.Move(Unit, Count)

Syntax 2

expression.Move(Left, Top)

expression   Required. An expression that returns a Range or Selection object (Syntax 1) or an expression that returns an Application or Task object (Syntax 2).

Unit   Optional Variant. The unit by which the collapsed range or selection is to be moved. Can be one of the following WdUnits constants: wdCharacter, wdWord, wdSentence, wdParagraph, wdSection, wdStory, wdCell, wdColumn, wdRow, or wdTable. If expression returns a Selection object, you can also use wdLine. The default value is wdCharacter.

Count   Optional Variant. The number of units by which the specified range or selection is to be moved. If Count is a positive number, the object is collapsed to its end position and moved forward in the document by the specified number of units. If Count is a negative number, the object is collapsed to its start position and moved backward by the specified number of units. The default value is 1. You can also control the collapse direction by using the Collapse method before using the Move method.

If the range or selection is in the middle of a unit or isn't collapsed, moving it to the beginning or end of the unit counts as moving it one full unit.

Left   Required Long. The horizontal screen position of the specified window.

Top   Required Long. The vertical screen position of the specified window.

Remarks

The start position and end position of a collapsed range or selection are equal.

Applying the Move method to a range doesn't rearrange text in the document. Instead, it redefines the range to refer to a new location in the document.

If you apply the Move method to any range other than a Range object variable (for example, Selection.Paragraphs(3).Range.Move), the method has no effect.

Moving a Selection object collapses the selection and moves the insertion point either forward or backward in the document.