Share via


AddNodes Method

This content is no longer actively maintained. It is provided as is, for anyone who may still be using these technologies, with no warranties or claims of accuracy with regard to the most recent product version or service release.  

Inserts a new segment at the end of the freeform that's being created, and adds the nodes that define the segment. You can use this method as many times as you want to add nodes to the freeform you're creating. When you finish adding nodes, use the ConvertToShape 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.

MsoSegmentType

MsoSegmentType can be one of these MsoSegmentType constants.
msoSegmentCurve
msoSegmentLine

MsoEditingType

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 Microsoft 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