Reputation: 929
I have a Word document with pictures that are linked externally.
To save the pictures in the document I hit Alt + F9
by Office-->Prepare-->Edit links to file-->Save Picture in document
.
How do I handle this in a VBA macro?
Upvotes: 0
Views: 2022
Reputation: 1379
I'm not familiar with this feature (it looks like it was active in earlier versions of Word but hidden in 2010, which is what I have). But this seems to get at its functionality. Try this:
Sub SaveLinkedPictures()
Dim objDoc As Document
Dim objShape As InlineShape
Set objDoc = ActiveDocument
For Each objShape In objDoc.InlineShapes
objShape.LinkFormat.SavePictureWithDocument = True
Next objShape
End Sub
Is that what you're after? One thing to always try when macro recorder comes up empty is the Object Browser (from within the VBE, View > Object Browser). You can search for what you think a command or object might be called (in this case "link" or "savepicture"). It can help get closer when you don't know where to start.
Upvotes: 1