MoveLeft 方法

       

将所选内容向左移动,并返回移动距离的单位数。

expression.MoveLeft(Unit, Count, Extend)

expression   必需。该表达式返回一个 Selection 对象。

Unit   WdUnits,可选。所选内容移动距离的度量单位。

Count   Variant 类型,可选。所选内容移动距离的单位数。默认值是 1。

Extend   Variant 类型,可选。可以是 wdMovewdExtend。如果是 wdMove,则所选内容折叠到结束位置,并向左移动。如果是 wdExtend,则所选内容向左扩展。默认值是 wdMove

说明

如果 UnitwdCell,则 Extend 参数只能是 wdMove

示例

本示例将所选内容向左移动一个字符。如果移动成功,则 MoveLeft 方法返回 1。

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

本示例激活选中域的域底纹功能,插入 DATE 域,然后将所选内容向左移动,以选定该域。

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

本示例将所选内容移至表格的前一个单元格。

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