Muokkaa

Jaa


Selection.MoveUp method (Word)

Moves the selection up and returns the number of units that it has been moved.

Syntax

expression.MoveUp (Unit, Count, Extend)

expression Required. A variable that represents a Selection object.

Parameters

Name Required/Optional Data type Description
Unit Optional Variant The unit by which to move the selection. Can be one of the following WdUnits constants: wdLine, wdParagraph, wdWindow or wdScreen. The default value is wdLine. Use the wdWindow constant for the Unit argument to move to the top or bottom of the active window. Regardless of the value of Count (greater than 1 or less than -1), the wdWindow constant moves only one unit. Use the wdScreen constant to move more than one screen.
Count Optional Variant The number of units the selection is to be moved. The default value is 1.
Extend Optional Variant Specifies whether the selection is moved or extended. Can be either wdMove or wdExtend. If wdMove is used, the selection is collapsed to the endpoint and moved up. If wdExtend is used, the selection is extended up. The default value is wdMove.

Return value

Long

Example

This example moves the selection to the beginning of the previous paragraph.

Selection.MoveRight 
Selection.MoveUp Unit:=wdParagraph, Count:=2, Extend:=wdMove

This example displays the current line number, moves the selection up three lines, and displays the current line number again.

MsgBox "Line " & Selection.Information(wdFirstCharacterLineNumber) 
Selection.MoveUp Unit:=wdLine, Count:=3, Extend:=wdMove 
MsgBox "Line " & Selection.Information(wdFirstCharacterLineNumber)

See also

Selection Object

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.