Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/vba/17.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Vba 对于特定幻灯片中的每个形状_Vba_Powerpoint - Fatal编程技术网

Vba 对于特定幻灯片中的每个形状

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

我正在尝试使用幻灯片索引确定特定幻灯片中是否存在名为CA1的形状。
但是,我遇到了一个运行时错误:对象不支持此属性。

您正在枚举演示文稿中的幻灯片,而不是形状。 您应该列举幻灯片中的形状:

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