Reputation: 123
A piece of my code (to delete all shapes in the sheet) suddenly started to throw an error
"Object does not support this property or method"
and highlights the row If Shp.Type = msoAutoShape Then
This is a part of a big code I continuously update, but the code below is not a part of any cycle, IF, etc. What could be a reason?
Dim Shp As Shape
For Each Shp In ActWS.Shapes
If Shp.Type = msoAutoShape Then Shp.Delete
Next Shp
Upvotes: 0
Views: 759
Reputation: 43595
Your code works by me. Probably there is something with the shapes, that you are using. Can you run this:
Public Sub ale()
Dim Shp As Shape
For Each Shp In ActiveSheet.Shapes
If Shp.Type = msoAutoShape Then
Debug.Print Shp.Name
Shp.Delete
End If
Next Shp
End Sub
And share what is the last result from the Immediate window before the error comes? Also, can you confirm on which line of the new code the error comes?
Upvotes: 1