Add Method (Drawings Collection)

Applies To

Drawings Collection.

Description

Creates a new drawing using the first two vertices of the polygon as coordinates relative to cell A1 or the upper left corner of the chart. Additional vertices can be added to the first two vertices using the AddVertex method.

Syntax

object.Add(x1, y1, x2, y2, closed)

object

Required. The Drawings object.

x1, y1

Required. Specifies the position of the first coordinate of the polygon, in points (1/72 inch) relative to the top left corner of cell A1 or the upper left corner of the chart.

x2, y2

Required. Specifies the position of the second coordinate of the polygon, in points relative to the top left corner of cell A1 or the upper left corner of the chart.

closed

Required. If True, the new drawing is closed and the last vertex is always connected to the first vertex. If False, the drawing is open and the last vertex is not connected to the first vertex.

See Also

Add Method (Arcs and Lines), Add Method (DropDowns Collection), Add Method (Graphic Objects and Controls), AddVertex Method, Reshape Method, Vertices Property.

Example

This example creates a new open trapezoid on Sheet1.


With Worksheets("Sheet1").Drawings.Add(100, 100, 200, 100, False)
    .AddVertex 180, 200
    .AddVertex 80, 200
    .AddVertex 100, 100
    .Border.Weight = xlMedium
End With