Auto-Refresh INCLUDEPICTURE Field in Mail Merge Document

B

Bnpositive

I've developed a mail merge document that uses the INCLUDEPICTURE field with
an IF command to display a different logo depending on what company is
represented by the mail merge data.

The mail merge works fine, except that the user has to double-click on the
header section to open it for editing, CTRL+A to select all objects, then F9
to force refresh the object. This tells Microsoft to go look for the graphic
with the path specified.

When the user does this, the graphic refreshes and displays the correct
graphic with no problems. So the path is correct and the include function
works.

The problem is that I don't want to force (or rely on) the user to manually
know how and to complete the task manually.

I want the header to automatically refresh and display the image when the
template loads and before the mail merge is finished and completed.
 
G

Graham Mayor

That's how it works! You *may* get more consistent results if you use the
following syntax

{ INCLUDEPICTURE "D:\\My Documents\\My Pictures\\{ IF { Mergefield Name } =
"Condition" "Signature1.tif" "Signature2.tif" }" }

and update the field before running the merge to a new document

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP


<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 
B

Bnpositive

So there's no way to force the header to auto-refresh itself somehow in a
Macro or VB?

Here's my existing syntax if you want to review it.

{INCLUDEPICTURE
"\\\\ss-vpt\\Viewpoint\\Reports\\SSC\\Graphics\\Logo-Co{MERGEFIELD "JCCo"
}{IF {MERGEFIELD "JCCo" } = 98 {MERGEFIELD "Project"}}.JPG" \d}
 
G

Graham Mayor

If you update the includetext field(s) before you run the merge then the
merged document should show the correct images.
You can use the update code at http://www.gmayor.com/installing_macro.htm to
force an update.
You could intercept the merge to a new document command and add in the code
to update the fields before merging to a new document e.g.

Sub MailMergeToDoc()
Dim oStory As Range
For Each oStory In ActiveDocument.StoryRanges
oStory.Fields.Update
If oStory.StoryType <> wdMainTextStory Then
While Not (oStory.NextStoryRange Is Nothing)
Set oStory = oStory.NextStoryRange
oStory.Fields.Update
Wend
End If
Next oStory
Set oStory = Nothing
WordBasic.MailMergeToDoc
End Sub

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP


<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top