Shapes.AddShape Method

PowerPoint Developer Reference

Creates an AutoShape. Returns a Shape object that represents the new AutoShape.

Syntax

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, measured in points, of the left edge of the AutoShape relative to the left edge of the slide.
Top Required Single The position, measured in points, of the top edge of the AutoShape relative to the top edge of the slide.
Width Required Single The width of the AutoShape, measured in points.
Height Required Single The height of the AutoShape, measured in points.

Return Value
Shape

Remarks

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

Example

This example adds a rectangle to myDocument.

Visual Basic for Applications
  Set myDocument = ActivePresentation.Slides(1)
myDocument.Shapes.AddShape Type:=msoShapeRectangle, _
    Left:=50, Top:=50, Width:=100, Height:=200

See Also