ConvertToShape Method

Microsoft Publisher Visual Basic

object. Returns a Shape object that represents the new shape.

expression.ConvertToShape

expression    Required. An expression that returns one of the objects in the Applies To list.

Remarks

You must apply the AddNodes method to a FreeformBuilder object at least once before you use the ConvertToShape method or an error occurs.

Example

This example adds a freeform with four vertices to the first page in the active publication.

' Add a new freeform object.
With ActiveDocument.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