Muokkaa

Jaa


Shapes.AddShape method (PowerPoint)

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.

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

See also

Shapes Object

Support and feedback

Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.