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

Shapes Object (Publisher)

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

A collection of Shape objects that represent all the shapes on a page of a publication. Each Shape object represents an object in the drawing layer, such as an AutoShape, freeform, OLE object, or picture.

Note If you want to work with a subset of the shapes on a document — for example, to do something to only the AutoShapes on the document or to only the selected shapes — you must construct a ShapeRange collection that contains the shapes with which you want to work.

Example

Use the Shapes property to return the Shapes collection. The following example selects all the shapes on the first page of the active publication.

Sub SelectAllShapes() 
    ActiveDocument.Pages(1).Shapes.SelectAll 
End Sub

Note If you want to do something (like delete or set a property) to all the shapes in a publication at the same time, use the Range method to create a ShapeRange object that contains all the shapes in the Shapes collection, and then apply the appropriate property or method to the ShapeRange object.

Use one of the following methods of the Shapes collection: AddCallout, AddConnector, AddCurve, AddLabel, AddLine, AddOLEObject, AddPolyline, AddShape, AddTextbox, or AddTextEffect to add a shape to a publication and return a Shape object that represents the newly created shape. The following example adds a new shape to the active publication.

Sub AddNewShape() 
    ActiveDocument.Pages(1).Shapes.AddShape Type:=msoShapeFoldedCorner, _ 
        Left:=50, Top:=50, Width:=100, Height:=200 
End Sub

Use Shapes (index), where index is the index number, to return a single Shape object. The following example horizontally flips shape one on the first page of the active publication.

Sub FlipShape() 
    ActiveDocument.Pages(1).Shapes(1).Flip FlipCmd:=msoFlipHorizontal 
End Sub

Methods

Name
AddBuildingBlock
AddCallout
AddCatalogMergeArea
AddCatalogMergeFieldToCanvas
AddConnector
AddCurve
AddEmptyPictureFrame
AddGroupWizard
AddLabel
AddLine
AddOLEObject
AddPicture
AddPolyline
AddShape
AddTable
AddTextbox
AddTextEffect
AddWebControl
AddWebNavigationBar
AddWordArt
BuildFreeform
FindShapeByWizardTag
Item
Paste
Range
SelectAll

Properties

Name
Application
CanvasArrangementType
CanvasesCount
Count
Parent
© 2018 Microsoft