我需要检查一个连接器是否真的连接到一个形状,换句话说,它是否有 EndConnectedShape 返回的任何形状。到目前为止,我有这个,但它给了我一个错误:权限被拒绝:
Sub test()
Dim oSh, mySh As Shape
smth = "SomeName"
For Each oSh In ActivePresentation.Slides(1).Shapes
If oSh.Connector And oSh.Name = smth Then
' In the NEXT line the following error is returned:
' oSh.ConnectorFormat.EndConnectedShape = <Permission denied>
Set mySh = oSh.ConnectorFormat.EndConnectedShape
If Not IsEmpty(mySh) Then
oSh.ConnectorFormat.EndConnectedShape.Line.ForeColor.RGB = RGB(255, 0, 0)
End If
End If
Next oSh
End Sub
一定有一些非常简单的东西,但我无法弄清楚我错过了什么。有什么建议么?谢谢!