Archive of Mr Excel Message Board


Back to Excel VBA archive index
Back to archive home



selecting & deleting all pictures in VBA

Posted by Ian on December 21, 1999 7:33 AM
Is there a way of selecting all the pictures in a spreadsheet? I can't use the select("picture ##") method because the picture number is different every time. Maybe I could insert the pictures with assigned numbers?

Does this even make sense?


Check out our Excel VBA Resources

Re: selecting & deleting all pictures in VBA

Posted by Ivan Moala on December 22, 1999 3:02 AM

Ian
One way to delete ALL pictures (in activesheet) is;

Sub tester()
Dim DrObj
Dim Pict
Set DrObj = ActiveSheet.DrawingObjects
For Each Pict In DrObj
If Left(Pict.Name, 7) = "Picture" Then
Pict.Select
Pict.Delete
End If
Next
End Sub


Ivan




This archive is from the original message board at www.MrExcel.com.
All contents © 1998-2004 MrExcel.com.
Visit our online store to buy searchable CD's with thousands of VBA and Excel answers.
Microsoft Excel is a registered trademark of the Microsoft Corporation.
MrExcel is a registered trademark of Tickling Keys, Inc.