Move Method

Microsoft Publisher Visual Basic

expression.Move(Page, [After])

expression    Required. An expression that returns a Page object.

Page   Required Long. The index number of the Pages collection where the specified page will be moved.

After   Optional Boolean. True if the page will be inserted after the specified index number of the Pages collection specified by the Page parameter. Deafult is True.

ShowMove method as it applies to the TextRange object.

Collapses the specified range to its start position or end position and then moves the collapsed object by the specified number of units. This method returns a Long that represents the number of units by which the object was actually moved, or it returns 0 (zero) if the move was unsuccessful.

expression.Move(Unit, Size)

expression    Required. An expression that returns one of the above objects.

Unit   Required PbTextUnit. The unit by which the collapsed range or selection is to be moved.

PbTextUnit can be one of these PbTextUnit constants.
pbTextUnitCell
pbTextUnitCharacter
pbTextUnitCharFormat
pbTextUnitCodePoint
pbTextUnitColumn
pbTextUnitLine
pbTextUnitObject
pbTextUnitParaFormat
pbTextUnitParagraph
pbTextUnitRow
pbTextUnitScreen
pbTextUnitSection
pbTextUnitSentence
pbTextUnitStory
pbTextUnitTable
pbTextUnitWindow
pbTextUnitWord

Size   Required Long. The number of units by which the specified range or selection is to be moved. If Size is a positive number, the object is collapsed to its end position and moved forward in the document by the specified number of units. If Size is a negative number, the object is collapsed to its start position and moved backward by the specified number of units. You can also control the collapse direction by using the Collapse method before using the Move method.

ShowMove method as it applies to the Window object.

Moves the active document window.

expression.Move(Left, Top)

expression    Required. An expression that returns one of the above objects.

Left   Required Long. The horizontal screen position of the specified window.

Top   Required Long. The vertical screen position of the specified window.

Remarks

If the application window is either maximized or minimized, this method will return an error.

Example

ShowAs it applies to the Page object.

This example moves the first page of the publication before the third page of the publication. This example assumes that there are at least three pages in the document.

ActiveDocument.Pages(1).Move page:=3, After:=False
				

ShowAs it applies to the TextRange object.

This example collapses the specified range and inserts a new sentence at the beginning of the range.

Sub MoveText()
    Dim rngText As TextRange
    Set rngText = ActiveDocument.Pages(1).Shapes(1).TextFrame _
        .TextRange.Words(Start:=1, Length:=5)
    With rngText
        .Move Unit:=pbTextUnitParagraph, Size:=-1
        .Text = "This adds new text to the beginning of the range.  "
    End With
End Sub
				

ShowAs it applies to the Window object.

This example checks the state of the application window, and if it is neither maximized nor minimized, moves the window to the upper left corner of the screen.

Sub MoveWindow()
    With ActiveWindow
        If .WindowState = pbWindowStateNormal Then
            .Move Left:=50, Top:=50
        End If
    End With
End Sub