Share via


AddShape Method

This content is no longer actively maintained. It is provided as is, for anyone who may still be using these technologies, with no warranties or claims of accuracy with regard to the most recent product version or service release.

Adds a new Shape object representing an AutoShape to the specified Shapes collection.

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

expression   Required. An expression that returns one of the objects in the Applies To list.

Type  Required MsoAutoShapeType. The type of AutoShape to draw. For a complete list of MsoAutoShapeType constants, see the Object Browser.

Left  Required Variant. The position of the left edge of the shape representing the AutoShape.

Top  Required Variant. The position of the top edge of the shape representing the AutoShape.

Width  Required Variant. The width of the shape representing the AutoShape.

Height  Required Variant. The height of the shape representing the AutoShape.

Remarks

For the Left, Top, Width, and Height arguments, numeric values are evaluated in points; strings can be in any units supported by Microsoft Publisher (for example, "2.5 in").

Example

The following example adds a rectangle to the first page of the active publication.

  Dim shpShape As Shape

Set shpShape = ActiveDocument.Pages(1).Shapes.AddShape _
    (Type:=msoShapeRectangle, _
    Left:=144, Top:=144, _
    Width:=72, Height:=144)