I have a series of large Microsoft Excel 2010 spreadsheets with images in them, and I need to remove 2/3 of those images. All the images I need to remove contain the same string of characters in the title, "Err". The images I need to keep do not contain that string of characters.

Is there a way to find and delete images by partial name?

link|improve this question
Are those images in seperate tabs, or mashed up within a table? I think you might want to check out the scripting options of Excel. I know that you can get the contents of cells in a spreadsheet and the names of tabs and worksheets programmatically and also alter them. VB is the official language i guess. I used some python bindings some time ago. – snies Jan 31 at 7:14
feedback

1 Answer

Taking your criteria literally "Err" in the picture name. If you want to extend this to include "err" then convert the picture name to upper or lowercase and search for that with InStr.

Sub deleteErrPics()
 For Each pic In ActiveSheet.Shapes
 If InStr(1, pic.Name, "Err") <> 0 Then pic.Delete
 Next pic
End Sub
link|improve this answer
@Steve did this not work for you? Is this still unresolved? – datatoo Feb 3 at 23:11
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.