MoveDown Method

Microsoft Word Visual Basic

MoveDown Method

       

Moves the selection down and returns the number of units it's been moved.

Note   The wdWindow constant can be used 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.

expression.MoveDown(Unit, Count, Extend)

expression   Required. An expression that returns a Selection object.

Unit   Optional WdUnits. The unit by which the selection is to be moved.

        Can be one of the following WdUnits constants.

        wdLine

        wdParagraph

        wdWindow

        wdScreen

The default value is wdLine.

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 end point and moved down. If wdExtend is used, the selection is extended down. The default value is wdMove.

Example

This example extends the selection down one line.

Selection.MoveDown Unit:=wdLine, Count:=1, Extend:=wdExtend

This example moves the selection down three paragraphs. If the move is successful, "Company" is inserted at the insertion point.

unitsMoved = Selection.MoveDown(Unit:=wdParagraph, _
    Count:=3, Extend:=wdMove)
If unitsMoved = 3 Then Selection.Text = "Company"

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

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