📅  最后修改于: 2022-03-11 14:48:10.793000             🧑  作者: Mango
Function shapeExists(shapeName As String) As Boolean
'returns TRUE if a shape named [ShapeName] exists on the active worksheet
Dim sh As Shape
For Each sh In ActiveSheet.Shapes
If sh.Name = shapeName Then shapeExists = True
Next sh
End Function
'Example Usage
If Not shapeExists("My Shape Name") Then MsgBox "Shape not found!"