N
newbie
I used the following code that allows me to identify and delete a specific
object in the worksheet via a user interface. The code works this morning but
don't know why, when or how, this Runtime Error 1004: Application or
object-defined error. appears at the line every time the program tries to
delete the object. Someone suggested me to use clean registry but I have not
really tried it yet. Is there a way to avoid this problem? I hope to find a
simple way that can perform the same function as the following code? Your
advice or help will be greatly appreciated.
Thanks.
Public Sub Deleteonstrfr()
Dim Obj As Object
For Each Obj In Sheets("SLD").Shapes
If Left(Obj.Name, 7) = "onstrfr" Then
Obj.Delete '***Run-time Error found at here'
End If
Next Obj
End Sub
object in the worksheet via a user interface. The code works this morning but
don't know why, when or how, this Runtime Error 1004: Application or
object-defined error. appears at the line every time the program tries to
delete the object. Someone suggested me to use clean registry but I have not
really tried it yet. Is there a way to avoid this problem? I hope to find a
simple way that can perform the same function as the following code? Your
advice or help will be greatly appreciated.
Thanks.
Public Sub Deleteonstrfr()
Dim Obj As Object
For Each Obj In Sheets("SLD").Shapes
If Left(Obj.Name, 7) = "onstrfr" Then
Obj.Delete '***Run-time Error found at here'
End If
Next Obj
End Sub