Skip to main content

Shapes.BuildFreeform method

Builds a freeform object. Returns a FreeformBuilder object that represents the freeform as it is being built.

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 have defined in the FreeformBuilder 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 upper-left corner of the document.
Y1 Required Single The position (in points) of the first node in the freeform drawing relative to the upper-left corner of the document.

Return value

FreeformBuilder

Example

This example adds a freeform with five vertices to myDocument.

Set myDocument = Worksheets(1)
With myDocument.Shapes.BuildFreeform(msoEditingCorner, 360, 200)
    .AddNodes msoSegmentCurve, msoEditingCorner, 380, 230, 400, 250, 450, 300
    .AddNodes msoSegmentCurve, msoEditingAuto, 480, 200
    .AddNodes msoSegmentLine, msoEditingAuto, 480, 400
    .AddNodes msoSegmentLine, msoEditingAuto, 360, 200
    .ConvertToShape
End With

Leave a comment

Your email address will not be published. Required fields are marked *

Format your code: <pre><code class="language-vba">place your code here</code></pre>