Shapes Property
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.
Returns a Shapes collection that represents all the Shape objects in the specified publication. This collection can contain drawings, shapes, pictures, OLE objects, ActiveX controls, text objects, and callouts.
expression.Shapes
expression Required. An expression that returns one of the objects in the Applies To list.
Remarks
For information about returning a single member of a collection, see Returning an Object from a Collection.
Example
This example adds a rectangle to the first page in the active publication.
Sub AddNewRectangle()
ActiveDocument.Pages(1).Shapes.AddShape Type:=msoShapeRectangle, _
Left:=5, Top:=25, Width:=100, Height:=50
End Sub
This example sets the fill texture for all the shapes in the active publication. This example assumes there is at least one shape in the active publication.
Sub SetNewTextureForAllShapes()
Dim shp As Shape
For Each shp In ActiveDocument.Pages(1).Shapes
shp.Fill.PresetTextured PresetTexture:=msoTextureOak
Next shp
End Sub
This example adds a shadow to the first shape in the active publication. This example assumes there is at least one shape in the active publication.
Sub SetShadowForFirstShape()
ActiveDocument.Pages(1).Shapes(1).Shadow.Type = msoShadow6
End Sub
This example displays a count of all shapes on the first page of the active publication. This example assumes there is at least one shape in the active publication.
Sub CountShapesOnFirstPage()
MsgBox "You have " & ActiveDocument.Pages(1) _
.Shapes.Count & " shapes on the first page."
End Sub