Partager via


Selection.MoveLeft Method (Word)

Moves the selection to the left and returns the number of units it has been moved.

Syntax

expression .MoveLeft(Unit, Count, Extend)

expression Required. A variable that represents a Selection object.

Parameters

Name

Required/Optional

Data Type

Description

Unit

Optional

WdUnits

The unit by which the selection is to be moved.The default value is wdCharacter.

Count

Optional

Variant

The number of units the selection is to be moved. The default value is 1.

Extend

Optional

Variant

Can be either wdMove or wdExtend. If wdMove is used, the selection is collapsed to the endpoint and moved to the left. If wdExtend is used, the selection is extended to the left. The default value is wdMove.

Remarks

When the Unit is wdCell, the Extend argument will only be wdMove.

Example

This example moves the selection one character to the left. If the move is successful, MoveLeft returns 1.

If Selection.MoveLeft = 1 Then MsgBox "Move was successful"

This example enables field shading for the selected field, inserts a DATE field, and then moves the selection left to select the field.

ActiveDocument.ActiveWindow.View.FieldShading = _ 
 wdFieldShadingWhenSelected 
With Selection 
 .Fields.Add Range:=Selection.Range, Type:=wdFieldDate 
 .MoveLeft Unit:=wdWord, Count:=1 
End With

This example moves the selection to the previous table cell.

If Selection.Information(wdWithInTable) = True Then 
 Selection.MoveLeft Unit:=wdCell, Count:=1, Extend:=wdMove 
End If

See Also

Concepts

Selection Object Members

Selection Object