Class GroupShapes (Excel VBA)

The class GroupShapes represents the individual shapes within a grouped shape. To use a GroupShapes class variable it first needs to be instantiated, for example

Count

Returns a Long value that represents the number of objects in the collection.


Dim gss As GroupShapes: Set gss = 
Dim lngCount As Long
lngCount = gss.Count

Item

Returns a single object from a collection.

Item (Index)

Index: The name or index number for the object.


Dim gss As GroupShapes: Set gss = 
Dim shpGroupShape As Shape
Set shpGroupShape = gss(Index:=1)

Range

Returns a ShapeRange object that represents a subset of the shapes in a Shapes collection.

Although you can use the Range property to return any number of shapes, it is simpler to use the Item method if you want to return only a single member of the collection. For example, Shapes(1) is simpler than Shapes.Range(1).

Range (Index)

Index: The individual shapes to be included in the range. Can be an integer that specifies the index number of the shape, a string that specifies the name of the shape, or an array that contains either integers or strings.


Set myDocument = Worksheets(1) 
myDocument.Shapes.Range(Array(1, 3)) _ 
 .Fill.Patterned msoPatternHorizontalBrick