ShapeNodes.SetPosition method (Publisher)

Sets the position of the specified node. Depending on the editing type of the node, this method may affect the position of adjacent nodes.

Syntax

expression.SetPosition (Index, X1, Y1)

expression A variable that represents a ShapeNodes object.

Parameters

Name Required/Optional Data type Description
Index Required Integer 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 Microsoft 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 

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.