MoveRight 方法

       

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

expression.MoveRight(Unit, Count, Extend)

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

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

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

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

说明

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

示例

本示例将所选内容移至前一个域之前,然后选定该域。

With Selection
    Set MyRange = .GoTo(wdGoToField, wdGoToPrevious)
    .MoveRight Unit:=wdWord, Count:=1, Extend:=wdExtend
    If Selection.Fields.Count = 1 Then Selection.Fields(1).Update
End With

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

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

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

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