Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|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 '12 at 7:14

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
share|improve this answer
@Steve did this not work for you? Is this still unresolved? – datatoo Feb 3 '12 at 23:11

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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