Class GroupShapes (PowerPoint VBA)

The class GroupShapes represents the individual shapes within a grouped shape. Each shape is represented by a Shape object. Using the Itemmethod with this object, you can work with single shapes within a group without having to ungroup them. To use a GroupShapes class variable it first needs to be instantiated, for example


Dim gss as GroupShapes
Set gss = ActiveWindow.RangeFromPoint.Ungroup

Count

Returns the number of objects in the specified collection.


Dim lngCount As Long
lngCount = ActiveWindow.RangeFromPoint.Ungroup.GroupItems.Count

Item

Returns a single Shape object from the specified GroupShapes collection.

Item (Index)

Index: The name or index number of the single Shape object in the collection to be returned.


Dim shpGroupShape As Shape
Set shpGroupShape = ActiveWindow.RangeFromPoint.Ungroup.GroupItems(Index:=1)

Range

Returns a ShapeRange object.

Although you can use the Range method to return any number of shapes or slides, it is simpler to use the Item method if you only want to return a single member of the collection. For example, Shapes(1) is simpler than Shapes.Range(1), and Slides(2) is simpler than Slides.Range(2). To specify an array of integers or strings for Index, you can use the Array function. For example, the following instruction returns two shapes specified by name. Dim myArray() As Variant, myRange As Object myArray = Array("Oval 4", "Rectangle 5") Set myRange = ActivePresentation.Slides(1).Shapes.Range(myArray)

Range (Index)

Index: The individual shapes that are 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. If this argument is omitted, the Range method returns all the objects in the specified collection.


Dim lngIndex() As Long: lngIndex() = 
Dim sreRange As ShapeRange
Set sreRange = ActiveWindow.RangeFromPoint.Ungroup.GroupItems.Range(Index:=lngIndex())