How do you programmatically delete ALL images from a word doc using VBA?
Posted on 2009-07-10
I would like to remove all images from a document programmatically. I'm using Microsoft Office 2003 and the word 11.0 object library.
I've seen this question answered elsewhere with the following script :
Dim objPic As InlineShape
For Each objPic In word_doc.InlineShapes
Whilst there are circumstances where this code removes some of the images, there are plenty of occasions where it does not. I have a document with a header/footer containing images, these were for example unaffacted.
Is there an enhancement to this code that would literally clean ALL images, wherever they may be. I am not concerned with how the layout of the document might be adversely affected.