Help me with Excel

UlricT

Golden Member
Jul 21, 2002
1,966
0
0
I am working on standardizing some documents, and there are a LOT of unnecessary embedded images that have been resized to a line to make it disappear from the .xls file. Is there a way to list these out, or select all of them so I can modify/delete them?
 

mayest

Senior member
Jun 30, 2006
306
0
0
Just to be safe, you should probably do the following to a copy of your workbook.

To list all of the shapes on a worksheet, place the following code in a VBA module in your workbook:

Sub ListAllShapes()
Dim S As Shape
Dim i As Integer
i = 1
For Each S In ActiveSheet.Shapes
Range("Sheet3!A" & Trim(Str(i))).Value = S.Name
i = i + 1
Next
End Sub

Then go to Tools --> Macro --> Macros and run the ListAllShapes macro. It will cycle through all of the shapes on the active worksheet and list their names in column A of Sheet3. You will probably want to change the "Sheet3!A" string to something like "MySheetName!A" where MySheetName is the name of a blank worksheet.

If you just want to do a wholesale (and undoable) deletion, then you can use this code instead:

Sub DeleteAllShapes()
Dim S As Shape
For Each S In ActiveSheet.Shapes
S.Delete
Next
End Sub