2
votes

Thanks Doug :-)

I need an idea for a non-programmer how to achieve iterating through groups.

I started with SO which works fine as long as I only take the .Names of the shapes.

But I need to try to check the type of every item in the group too I have a whole subset of questions to the shape (Sub CheckTextConformity)

This is the code as it runs - but ignores Groups. I started with the idea to call A subroutine for groups - but then what if the Group contains groups too etc.?

From Sub CheckAndReportOhneGroups() I call Sub WhatTypes... and depending on the type I call CheckTextConformity to give me information about the shape (especially text info).

1
Welcome to SO. Your question would be easier to read, and maybe answer, if you edit out the meandering self-criticism and focus on a clear description of what you need to do and where it's failing. It's great that you included code, but it's hard to tell which parts you need help with. We all begin somewhere and people on this site understand that :). - Doug Glancy

1 Answers

8
votes

To deal with groups (and possibly groups within groups) use something like this:

Sub Example()

Dim oSh As Shape
Dim oSl As Slide

For Each oSl In ActivePresentation.Slides
    For Each oSh In oSl.Shapes
        If oSh.Type = msoGroup Then
            'Debug.Print "GROUP"
            Call DealWithGroups(oSh)
        Else
            Debug.Print oSh.Name & vbTab & oSh.Type
        End If
    Next
Next

End Sub

Sub DealWithGroups(oSh As Shape)
    Dim x As Long
    Debug.Print "GROUP"
    For x = 1 To oSh.GroupItems.Count
        If oSh.GroupItems(x).Type = msoGroup Then
            Call DealWithGroups(oSh.GroupItems(x))
        Else
            Debug.Print vbTab & oSh.GroupItems(x).Name & vbTab & oSh.GroupItems(x).Type
        End If
    Next
End Sub

Yes. The snake is eating its own tail. ;-)