Bob Berg was telling us:
Bob Berg nous racontait que :
I am now trying:
Sub TMGPhotoLink()
Dim pShape As Word.InlineShape
Const pNewFolder = "c:\tmg6\reports\"
For Each pShape In ActiveDocument.InlineShapes
pShape.LinkFormat.SourceFullName = pNewFolder &
pShape.LinkFormat.SourceName
Next
End Sub
Still doesn't work, by the way using Word 2003
I have just tried the code you posted by doing the following:
1) Created a blank document;
2) Added two linked inline images located at:
"X:\Office 2003\OriginalFolder\"
(To make sure they are inline, select an image, do SHIFT-F9
and you should see an INCLUDEPICTURE field instead of
the image, do F9 to update the image and hide the field code)
3) Moved the images to:
"X:\Office 2003\NewFolder\"
4) Updated the images in the document;
5) As expected, the images were replaced by a red "X" in a white rectangle;
6) Ran this code:
Sub TMGPhotoLink()
Dim pShape As Word.InlineShape
Const pNewFolder = "X:\Office 2003\NewFolder\"
For Each pShape In ActiveDocument.InlineShapes
pShape.LinkFormat.SourceFullName = pNewFolder & _
pShape.LinkFormat.SourceName
Next
End Sub
7) The images were automatically updated;
8) Just to be sure, I selected the images and hit SHIFT-F9 to see the field
code;
9) The new path was there.
You only stated "Still doesn't work". This doesn't give us much to go on.
You have to be more explicit.
Is the macro running seemingly OK, but images are still represented by
red "X"'s?
Do you get an error message?
I would suggest you try the 9 steps above with a brand new document.
If it works, then compare those 9 steps with you have done with your current
document. What is the difference?
If it does not, post back describing exactly what you have done and the
on-screen results.
--
Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
(e-mail address removed)
Word MVP site:
http://www.word.mvps.org