MrExcel Publishing
Your One Stop for Excel Tips & Solutions

VBA object delete


Posted by mateo on October 17, 2000 8:53 PM

I have a button, that opens a bitmap file as an object in Excel. The problem is, I want a button that will select and delete that object.

What I am running into, is that every time an object is created in the sheet, it is given a different number (Picture 26), thus I have not been able figure out how to select it to delete it.

I know how to delete it. I don't know how to select it based on the new object number (picture number)


Posted by Ivan Moala on October 18, 2000 2:33 AM

Try this

Sub DeletePicts()
Dim Pict As Object

For Each Pict In ActiveSheet.Shapes
If Pict.Type = 13 Then
Pict.Delete
End If
Next
End Sub


Ivan