FreeformBuilder Object

Microsoft Publisher Visual Basic

FreeformBuilder Object

FreeformBuilder

Represents the geometry of a freeform while it's being built.

Using the FreeformBuilder Object

Use the BuildFreeform method of the Shapes collection to return a FreeformBuilder object. Use the AddNodes method to add nodes to the freeform. Use the ConvertToShape method to create the shape defined in the FreeformBuilder object and add it to the Shapes collection. The following example adds a freeform with four segments to the active document.

Sub CreateNewFreeFormShape()
    With ActiveDocument.Pages(1).Shapes.BuildFreeform( _
            EditingType:=msoEditingCorner, X1:=360, Y1:=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
End Sub