AddNodes Method

Microsoft Publisher Visual Basic

method to create the freeform you've just defined.

expression.AddNodes(SegmentType, EditingType, X1, Y1, X2, Y2, X3, Y3)

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

SegmentType   Required MsoSegmentType. The type of segment to be added.

MsoSegmentType can be one of these MsoSegmentType constants.
msoSegmentCurve
msoSegmentLine

EditingType   Required MsoEditingType. Specifies the editing type of the new node. If SegmentType is msoSegmentLine, EditingType must be msoEditingAuto; otherwise, an error occurs..

MsoEditingType can be one of these MsoEditingType constants.
msoEditingAuto Adds a node type appropriate to the segments being connected.
msoEditingCorner Adds a corner node.
msoEditingSmooth Not used with this method.
msoEditingSymmetric Not used with this method.

X1   Required Variant. If the EditingType of the new segment is msoEditingAuto, this argument specifies the horizontal distance from the upper-left corner of the page to the end point of the new segment. If the EditingType of the new node is msoEditingCorner, this argument specifies the horizontal distance from the upper-left corner of the page to the first control point for the new segment.

Y1   Required Variant. If the EditingType of the new segment is msoEditingAuto, this argument specifies the vertical distance from the upper-left corner of the page to the end point of the new segment. If the EditingType of the new node is msoEditingCorner, this argument specifies the vertical distance from the upper-left corner of the page to the first control point for the new segment.

X2   Optional Variant. If the EditingType of the new segment is msoEditingCorner, this argument specifies the horizontal distance from the upper-left corner of the page to the second control point for the new segment. If the EditingType of the new segment is msoEditingAuto, don't specify a value for this argument.

Y2   Optional Variant. If the EditingType of the new segment is msoEditingCorner, this argument specifies the vertical distance from the upper-left corner of the page to the second control point for the new segment. If the EditingType of the new segment is msoEditingAuto, don't specify a value for this argument.

X3   Optional Variant. If the EditingType of the new segment is msoEditingCorner, this argument specifies the horizontal distance from the upper-left corner of the page to the end point of the new segment. If the EditingType of the new segment is msoEditingAuto, don't specify a value for this argument.

Y3   Optional Variant. If the EditingType of the new segment is msoEditingCorner, this argument specifies the vertical distance from the upper-left corner of the page to the end point of the new segment. If the EditingType of the new segment is msoEditingAuto, don't specify a value for this argument.

Remarks

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

To add nodes to a freeform after it's been created, use the Insert method of the ShapeNodes collection.

Example

This example adds a freeform with four vertices to the first page in the active publication.

' Add a new freeform object.
With ActiveDocument.Pages(1).Shapes _
        .BuildFreeform(EditingType:=msoEditingCorner, _
        X1:=100, Y1:=100)

    ' Add three more nodes and close the polygon.
    .AddNodes SegmentType:=msoSegmentCurve, _
        EditingType:=msoEditingCorner, _
        X1:=200, Y1:=200, X2:=225, Y2:=250, X3:=250, Y3:=200
    .AddNodes SegmentType:=msoSegmentCurve, _
        EditingType:=msoEditingAuto, X1:=200, Y1:=100
    .AddNodes SegmentType:=msoSegmentLine, _
        EditingType:=msoEditingAuto, X1:=150, Y1:=50
    .AddNodes SegmentType:=msoSegmentLine, _
        EditingType:=msoEditingAuto, X1:=100, Y1:=100

    ' Convert the polygon to a Shape object.
    .ConvertToShape
End With