Shapes.BuildFreeform method (Project)

Creates a FreeformBuilder object that represents a new freeform drawing. The freeform drawing can be converted into a Shape object.

Syntax

expression. BuildFreeform (EditingType, X1, Y1)

expression A variable that represents a Shapes object.

Parameters

Name Required/Optional Data type Description
EditingType Required MsoEditingType The editing property of the first node.
X1 Required Single The position (in points) of the first node in the freeform drawing, relative to the left edge of the report.
Y1 Required Single The position (in points) of the first node in the freeform drawing, relative to the top edge of the report.
EditingType Required MSOEDITINGTYPE
X1 Required FLOAT
Y1 Required FLOAT
Name Required/Optional Data type Description

Return value

FreeformBuilder

Remarks

Use the AddNodes method to add segments to the freeform. After you have added at least one segment to the freeform, you can use the ConvertToShape method to convert the FreeformBuilder object into a Shape object that has the geometric description that you defined.

Example

The following example adds a freeform with five vertices to the report, converts the freeform to a shape, and then changes the background style of the shape.

Sub AddFreeform2()
    Dim shapeReport As Report
    Dim reportName As String
    Dim freeformBuild As FreeformBuilder
    Dim freeformShape As shape

    reportName = "Freeform2 report"
    Set shapeReport = ActiveProject.Reports.Add(reportName)
    
    Set freeformBuild = shapeReport.Shapes.BuildFreeform(msoEditingCorner, 360, 200)
    
    With freeformBuild
        .AddNodes msoSegmentCurve, msoEditingCorner, 380, 230, 400, 450, 300
        .AddNodes msoSegmentCurve, msoEditingAuto, 480, 200
        .AddNodes msoSegmentLine, msoEditingAuto, 480, 400
        .AddNodes msoSegmentLine, msoEditingAuto, 360, 200
        .ConvertToShape
    End With
    
    Set freeformShape = shapeReport.Shapes(1)
    
    freeformShape.BackgroundStyle = msoBackgroundStylePreset10
End Sub

See also

Shapes Object Shape Object

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.