Vba 对于特定幻灯片中的每个形状
我正在尝试使用幻灯片索引确定特定幻灯片中是否存在名为CA1的形状。Vba 对于特定幻灯片中的每个形状,vba,powerpoint,Vba,Powerpoint,我正在尝试使用幻灯片索引确定特定幻灯片中是否存在名为CA1的形状。 但是,我遇到了一个运行时错误:对象不支持此属性。您正在枚举演示文稿中的幻灯片,而不是形状。 您应该列举幻灯片中的形状: Sub FindingIfShapeNamesCA1Exists() Dim shp As Shape For Each shp In ActivePresentation.Slides(2) If shp.Name = "CA1" Then MsgBox "y" End If
但是,我遇到了一个运行时错误:对象不支持此属性。您正在枚举演示文稿中的幻灯片,而不是形状。 您应该列举幻灯片中的形状:
Sub FindingIfShapeNamesCA1Exists()
Dim shp As Shape
For Each shp In ActivePresentation.Slides(2)
If shp.Name = "CA1" Then
MsgBox "y"
End If
Next shp
End Sub
您正在枚举演示文稿中的幻灯片,但没有枚举形状。 您应该列举幻灯片中的形状:
Sub FindingIfShapeNamesCA1Exists()
Dim shp As Shape
For Each shp In ActivePresentation.Slides(2)
If shp.Name = "CA1" Then
MsgBox "y"
End If
Next shp
End Sub