編輯

共用方式為


Selection.Move(Object, Object) Method

Definition

Collapses the specified selection to its start or end position and then moves the collapsed object by the specified number of units.

public int Move (ref object Unit, ref object Count);
abstract member Move : obj * obj -> int
Public Function Move (Optional ByRef Unit As Object, Optional ByRef Count As Object) As Integer

Parameters

Unit
Object

Optional Object. The unit by which the collapsed selection is to be moved. Can be one of the following WdUnits constants: wdCharacter, wdWord, wdLine, wdSentence, wdParagraph, wdSection, wdStory, wdCell, wdColumn, wdRow, or wdTable. The default value is wdCharacter.

Count
Object

Optional Object. The number of units by which the specified selection is to be moved. If Count is a positive number, the object is collapsed to its end position and moved backward 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 forward by the specified number of units. The default value is 1. You can also control the collapse direction by using the Collapse(Object) 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.

Returns

Remarks

This method returns an Integer value that indicates the number of units by which the object was actually moved, or it returns 0 (zero) if the move was unsuccessful.

The start and end positions of a collapsed selection are equal.

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

Applies to