Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Deleting pictures with Excel VBA

Tags:

vba

excel-2007

How do I delete all the pictures in an Excel 2007 worksheet? A working code example would be great.

like image 756
Arlen Beiler Avatar asked Dec 18 '10 21:12

Arlen Beiler


2 Answers

Dim shape As Excel.shape

For Each shape In ActiveSheet.Shapes
        shape.Delete
Next
like image 194
Eric Fortis Avatar answered Sep 21 '22 20:09

Eric Fortis


The simplest way:

Activesheet.Pictures.Delete

or

Activesheet.Shapes.Delete

Depending on the type of object your picture is.

Deletes all pictures with greater efficiency then iterating (looping through) and deleting them one by one.

like image 30
jony Avatar answered Sep 19 '22 20:09

jony