April 2006
Beginner
1114 pages
98h 16m
English
Use the GroupShapes collection to get individual shapes that have been grouped together as a single shape. Use the Shape object’s GroupItems property to get a reference to this collection. The GroupShapes collection has the following members:
Application Count Creator Item Parent Range
Use the ShapeRange object’s Group method to group multiple shapes so that they can be selected, moved, or deleted as a single shape by the user. The grouped Shape object then has a GroupItems property that you can use to get at the component shapes. The following code draws three stars and groups them:
Sub DrawGroup( )
Dim ws As Worksheet, sr As ShapeRange, s As Shape
Set ws = ActiveSheet
' Draw three stars.
ws.Shapes.AddShape(msoShape5pointStar, 30, 30, 40, 40).Duplicate.Duplicate
' Create a shape range for all shapes on sheet.
ws.Shapes.SelectAll
Set sr = Selection.ShapeRange
' Group all the items
Set s = sr.Group
' Show count of items in group.
Debug.Print s.GroupItems.Count & " shapes grouped."
End SubRead now
Unlock full access