The following code fails:
Function Shapes_Exist(WS As Worksheet, ShapeName As String) As Boolean
' does the shape with the ShapeName name exist?
Dim tmpID As Long
On Error Resume Next
Shapes_Exist = False
tmpID = WS.Shapes(ShapeName).Id
If IsEmpty(tmpID) Then
Shapes_Exist = False
Else
Shapes_Exist = True
End If
On Error GoTo 0
End Function
TempBool = Shapes_Exist(BWS, GroupName)
If TempBool = True Then
DupeFound = True
Set pShape = BWS.Shapes(GroupName)
End If
gives the following error:
Run-Time error '-2147024809 (80070057)':
The item with the specified name wasn't found
the shape with the name "GroupName" does not exist, but my function returns true that it does exist. Not sure why. Please help. Thanks.
Bookmarks