📜  vba 检查形状名称是否存在 - 汇编代码示例

📅  最后修改于: 2022-03-11 14:48:10.793000             🧑  作者: Mango

代码示例1
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!"