I am trying to access a sub-group with a group in VBA (PPTX), NOT all shapes. For example:
Here is my grouping structure
- Group 1
- Group 2
- Line 1
- Rectangle 1
- Rectangle 2
- Group 2
I want GroupItems.Count to be 2 (one group and one rectangle) instead of 3 (two rectangles and one line)! Obviously GroupItems.Count goes to the lowest level, but what function/property do I need here? How do I access the "next grouping layer" instead of the lowest grouping layer?
Dim allShapes As ShapeRange
Dim myShape as Shape
Dim i as Integer
Set allShapes = ActiveWindow.Selection.ShapeRange
For Each myShape In allShapes
If myShape.Type = msoGroup Then
Debug.Print myShape.GroupItems.Count
For i = 1 To myShape.GroupItems.Count
Debug.Print myShape.GroupItems(i).Type
Debug.Print myShape.GroupItems.Item(i).Name
Next i
End If
Next myShape