AddShape Method

Applies To

Shapes collection object.

Description

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

Syntax

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

expression Required. An expression that returns a Shapes collection.

Type Required Long. The type of AutoShape to be created. Can be any of the MsoAutoShapeType constants.

Left, Top Required Single. The position (in points) of the upper-left corner of the AutoShape's bounding box, relative to the anchor.

Width, Height Required Single. The width and height of the AutoShape's bounding box, in points.

Anchor Optional Variant. A Range object that represents the text that the AutoShape is bound to. If Anchor is specified, the anchor is positioned at the beginning of the first paragraph in the anchoring range. If this argument is omitted, the anchoring range is selected automatically and the AutoShape is positioned relative to the top and left edges of the page.

Remarks

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

See Also

InlineShape object.

Example

This example adds a rectangle to a new document.

Set myDocument = Documents.Add
myDocument.Shapes.AddShape msoShapeRectangle, 50, 50, 100, 200