我正在尝试检查我的智能作品中的特定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
结束子