AddNodes Method

Microsoft PowerPoint Visual Basic

Show All

AddNodes Method

       

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. To add nodes to a freeform after it's been created, use the Insert method of the ShapeNodes collection.

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

expression   Required. An expression that returns a FreeformBuilder object.

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

MsoSegmentType can be one of these MsoSegmentType constants.
msoSegmentCurve
msoSegmentLine

EditingType  Required MsoEditingType. The editing property of the vertex. If SegmentType is msoSegmentLine, EditingType must be msoEditingAuto.

MsoEditingType can be one of these MsoEditingType constants (cannot be msoEditingSmooth or msoEditingSymmetric).
msoEditingAuto
msoEditingCorner

X1   Required Single. If the EditingType of the new segment is msoEditingAuto, this argument specifies the horizontal distance (in points) from the upper-left corner of the document to the end point of the new segment. If the EditingType of the new node is msoEditingCorner, this argument specifies the horizontal distance (in points) from the upper-left corner of the document to the first control point for the new segment.

Y1   Required Single. If the EditingType of the new segment is msoEditingAuto, this argument specifies the vertical distance (in points) from the upper-left corner of the document to the end point of the new segment. If the EditingType of the new node is msoEditingCorner, this argument specifies the vertical distance (in points) from the upper-left corner of the document to the first control point for the new segment.

X2   Optional Single. If the EditingType of the new segment is msoEditingCorner, this argument specifies the horizontal distance (in points) from the upper-left corner of the document 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 Single. If the EditingType of the new segment is msoEditingCorner, this argument specifies the vertical distance (in points) from the upper-left corner of the document 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 Single. If the EditingType of the new segment is msoEditingCorner, this argument specifies the horizontal distance (in points) from the upper-left corner of the document 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 Single. If the EditingType of the new segment is msoEditingCorner, this argument specifies the vertical distance (in points) from the upper-left corner of the document 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.

Example

This example adds a freeform with five vertices to the first slide in the active presentation.

Set myDocument = ActivePresentation.Slides(1)
With myDocument.Shapes.BuildFreeform(msoEditingCorner, 360, 200)
    .AddNodes SegmentType:=msoSegmentCurve, EditingType:=msoEditingCorner, _
        X1:=380, Y1:=230, X2:=400, Y2:=250, X3:=450, Y3:=300
    .AddNodes SegmentType:=msoSegmentCurve, EditingType:=msoEditingAuto, _
        X1:=480, Y1:=200
    .AddNodes SegmentType:=msoSegmentLine, EditingType:=msoEditingAuto, _
        X1:=480, Y1:=400
    .AddNodes SegmentType:=msoSegmentLine, EditingType:=msoEditingAuto, _
        X1:=360, Y1:=200
    .ConvertToShape
End With