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

For Each Shape in a specific slide

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

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

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

Sub FindingIfShapeNamesCA1Exists()
    Dim shp As Shape      

    For Each shp In ActivePresentation.Slides(2).Shapes
        If shp.Name = "CA1" Then
            MsgBox "y"
        End If
    Next shp        
End Sub