I would like to create a Word macro to separate text and images. The macro should insert the text at first place and move the images inside the text to the end of the document and replace the image with an index showing the number of the image, starting from the first image to the last image. I would appreciate if someone could help with this.
I have looked in many sites and I have developed the following code. This code simply replaces any image in the document with a text which is a kind of index. For example, it replaces the first image with just simple index as “image1.jpg” and so on. But my problem is that I don’t want to just replace the image with a numbered text index. My goal is also to move for example the image 1 to the end of the document. This should happen for the second image in the document which is replacing the 2nd image with a numbered index and then moving the image to the end of the document (after the first image) and so on for other images. I guess that this code must be added with some other code to make this happen. if someone could help, it will help a lot for making web pages suitable for printing on papers using Microsoft word macro. because sometimes it is not always necessary to print the images in the document and the text alone would be enough.
Dim oILShp As InlineShape Dim ILShpIndex As Integer For Each oILShp In ActiveDocument.InlineShapes ILShpIndex = ILShpIndex + 1 'insert text in place where InlineShape is located ActiveDocument.Range(oILShp.Range.Start, oILShp.Range.End).Text = _ "[Image" & ILShpIndex & ".Jpg]" 'delete picture is not needed - it was simply replaced with text Next