Difficulties in iterating through ppt group member (vba absolute beginner)

mar*_*lls 2 iteration powerpoint vba

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.

但我需要尝试检查组中每个项目的类型,我对形状有一整个问题子集(Sub CheckTextConformity)

这是运行时的代码 - 但忽略了组.我开始想要为组调用A子例程 - 但是如果组也包含组等,该怎么办?

从Sub CheckAndReportOhneGroups()我调用Sub WhatTypes ...并根据我调用CheckTextConformity的类型给我有关形状的信息(特别是文本信息).

Ste*_*erg 5

要处理组(以及可能组内的组),请使用以下内容:

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
Run Code Online (Sandbox Code Playgroud)

是.蛇正在吃自己的尾巴.;-)