Table of contents
TOC
Collapse the table of content
Expand the table of content

Shapes.AddShape Method (Publisher)

office 365 dev account|Last Updated: 8/24/2017
|
3 Contributors

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

Syntax

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

_expression_A variable that represents a Shapes object.

Parameters

NameRequired/OptionalData TypeDescription
TypeRequiredMsoAutoShapeTypeThe type of AutoShape to draw. For a complete list of MsoAutoShapeType constants, see the Object Browser.
LeftRequiredVariantThe position of the left edge of the shape representing the AutoShape.
TopRequiredVariantThe position of the top edge of the shape representing the AutoShape.
WidthRequiredVariantThe width of the shape representing the AutoShape.
HeightRequiredVariantThe height of the shape representing the AutoShape.

Return Value

Shape

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) 
© 2018 Microsoft