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
Support and feedback
Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.