View Single Post
 
Old 12-10-2015, 01:34 AM
addey addey is offline Windows 7 64bit Office 2010 64bit
Novice
 
Join Date: Feb 2015
Posts: 10
addey is on a distinguished road
Default

Thanks for the suggestion Guessed! The issue is however not to get the image files out, but to get them back in at the correct place. And since the problem originally is the various image formats used within Word, simply using the ones in the zip file won't work.

Getting images into a Word doc is not a problem, this small code inserts the three test images I made in a sequential order.
Code:
Sub InsertImage()
    Dim i As Integer 
    For i = 1 To 3 
        Selection.InlineShapes.AddPicture FileName:= _
        "C:\path\test" & i & ".png", LinkToFile:=False, _
        SaveWithDocument:=True
    Next i
End Sub
As there are also ways of going through a document, selecting each InlineShape on the way, I was hoping there was a way to link the Selection in the above code to a selection in a code that runs through a document finding InlineShapes.

Macropod, the png images I want to include in the document are also sequentially numbered, and I know there is a way to walk through all InlineShapes in the document (i.e. sequential). And since it is also not a problem inserting an image at a selection, why would this be impossible? I am a VBA newb, so I'm just trying to figure stuff out... but getting a "that's not possible" answer when I see the outlines of a solution only wants me to dig deeper.

I am thinking of something like this (pseudocode):
Code:
For i = 1 to numberOfInlineShapesInDoc
  Select InlineShape
  Delete InlineShape
  Insert image_i.png 'one of the sequentially numbered images
Next i
Reply With Quote