Shapes.AddShape Method (Excel)

Office 2013 and later
GitHub-Mark-64px

Contribute to this content

Use GitHub to suggest and submit changes. See our guidelines for contributing to VBA documentation.

Returns a Shape object that represents the new AutoShape in a worksheet.

expression .AddShape(Type, Left, Top, Width, Height)

expression A variable that represents a Shapes object.

Parameters

Name

Required/Optional

Data Type

Description

Type

Required

MsoAutoShapeType

Specifies the type of AutoShape to create.

Left

Required

Single

The position (in points) of the upper-left corner of the AutoShape's bounding box relative to the upper-left corner of the document.

Top

Required

Single

The position (in points) of the upper-left corner of the AutoShape's bounding box relative to the upper-left corner of the document.

Width

Required

Single

The width of the AutoShape's bounding box, in points.

Height

Required

Single

The height of the AutoShape's bounding box, in points.

Return Value

Shape

To change the type of an AutoShape that you?ve added, set the AutoShapeType property.

This example adds a rectangle to myDocument.

Set myDocument = Worksheets(1) 
myDocument.Shapes.AddShape msoShapeRectangle, 50, 50, 100, 200

Concepts

Other resources

Show: