SetPosition Method

Microsoft Publisher Visual Basic

expression.SetPosition(Index, X1, Y1)

expression    Required. An expression that returns one of the objects in the Applies To list.

Index   Required Long. The node whose position is to be set. Must be a number from 1 to the number of nodes in the specified shape; otherwise, an error occurs.

X1   Required Variant. The horizontal position of the node relative to the upper-left corner of the page.

Y1   Required Variant. The vertical position of the node relative to the upper-left corner of the page.

Remarks

For the X1 and Y1 arguments, numeric values are evaluated in points; strings can be in any units supported by Publisher (for example, "2.5 in").

Example

This example moves the second node in the third shape in the active publication 200 points to the right and 300 points down. The shape must be a freeform drawing.

Dim arrPoints As Variant
Dim intX As Integer
Dim intY As Integer

With ActiveDocument.Pages(1).Shapes(3).Nodes
    arrPoints = .Item(2).Points
    intX = arrPoints(1, 1)
    intY = arrPoints(1, 2)
    .SetPosition Index:=2, X1:=intX + 200, Y1:=intY + 300
End With