SmartArt VBA PowerPoint обнаружение узлов - PullRequest
0 голосов
/ 21 ноября 2018

Я пытаюсь проверить наличие определенных символов RGB в моем умном искусстве.Для этого я написал следующий код. Он учитывает узлы, а в каждом узле он учитывает фигуры, а затем считывает каждый символ RGB.Он работает без ошибок, но не работает, когда есть дочерние узлы.Это работает только тогда, когда есть только один родительский узел.Любая идея, где проблема.

 Sub smartart(osmart As Shape, j)

 Dim tnodes As Integer
 Dim n, ns, nsc, ms, cs
 Dim u, v, w, t

u = 0
 v = 0
 w= 0
t = 0


tnodes = osmart.smartart.AllNodes.Count

Debug.Print tnodes
For n = 1 To tnodes

With osmart.smartart.AllNodes(n)

        ns = .Shapes.Count

        For nsc = 1 To ns

            With osmart.smartart.AllNodes(n).Shapes(nsc).TextFrame2.TextRange


                ms = .Characters.Count
                Debug.Print "chaaracters = " & ms

                    For cs = 1 To .Characters.Count

                        With .Characters(cs).Font.Fill

            If u <> 1 Then
                If .ForeColor.RGB = RGB(0, 0, 0) Then
                u = 1
                End If
            End If

            If v <> 1 Then
                If .ForeColor.RGB = RGB(0, 1, 1) Then
                Debug.Print "Slide (" & j & ") has secondary colour( " & osmart.Name & " )"

                ElseIf .ForeColor.RGB = RGB(5, 5, 5) Then
                Debug.Print "Slide (" & j & ") has secondary colour( " & osmart.Name & " )"
                v = 1
                End If
            End If

            If w <> 1 Then
                If .ForeColor.RGB = RGB(10, 2, 200) Then
                Debug.Print "Slide " & j & " has accent colour( " & osmart.Name & " )"
                w = 1

                ElseIf .ForeColor.RGB = RGB(6, 6, 66) Then
                Debug.Print "Slide " & j & " has accent colour( " & osmart.Name & " )"
                w = 1

                End If
            End If






                        End With
                    Next cs
            End With
        Next nsc
End With

Далее n

End Sub

...