MoveLeft Method
TOC
Collapse the table of content
Expand the table of content

Selection.MoveLeft Method (Word)

Office 2013 and later
GitHub-Mark-64px

Contribute to this content

Use GitHub to suggest and submit changes. See our guidelines for contributing to VBA documentation.

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

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.

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

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
Show:
© 2016 Microsoft