Hi =?Utf-8?B?bXI=?=,
I am using InsertFile because the pictures are in Word documents. I can change the
structure if needed. I must make a correction for a previous answer. These are
InlineShapes, which I found out after running the commands you asked for in the immediate
window. I must have run the code on some old test documents. There are actually 2
bookmarks in these documents, and both are filled using InsertFile to insert a picture
that is in another Word document. It looks like sometimes the bookmark is holding the
picture, and sometimes it is beside the picture. It depends on how the picture Word
document was created. I found that my original code works if the picture Word document
only has a paragraph mark after the picture. The code fails if a paragraph mark was
placed before the picture. I do not create the picture documents, so I need a solution
that will work for both situations, bookmark holding the picture, and bookmark beside the
picture.Thanks for the more detailed information. I think we can work something out based on it
How does this approach sound to you:
1. You use insert/file to bring in the Word document, which also contains a picture
(InlineShape)
2. We suppose that the bookmark will be either beside, or around the picture, but this
isn't 100% certain. Could we be sure, however, that the bookmark is in the same paragraph
with the picture, and that only the one picture is in the paragraph?
Then
Dim sBookmarkName as String
Dim rngInlineShape as Word.Range
Set rngInlineShape =
doc.Boomkarks(sBookmarkName).Range.Paragraphs(1).Range.InlineShapes(1).Range
rngInlineShape.InsertFile strFileName
'Make sure the bookmark still exists, even if it was removed by inserting the new picture
doc.Bookmarks.Add rngInlineShape, sBookmarkName
Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 8 2004)
http://www.word.mvps.org
This reply is posted in the Newsgroup; please post any follow question or reply in the
newsgroup and not by e-mail