Mail merge fails with images and section breaks

F

Fred from NYC

I use MS Office 2003 and Windows XP. My goal is to create individual
documents with text, tables and images from a mail merge. Previously, I
used a SplitMerge macro that I found at the website of Graham Mayor:

http://www.gmayor.com/individual_merge_letters.htm

I would run the mail merge, update the document by pressing Ctrl+A and
F9, and then run the SplitMerge macro to create individual files. I am
now working with a document where some pages are portrait and others
landscape. Because the formatting is controlled by section breaks, the
SplitMerge macro breaks up the pages for each record into separate
sections, partly overwriting previously saved documents from earlier
records.

A partial solution to this problem was a template called
MMtoDocsRev18.dot by Doug Robbins that I found on the same page as the
SplitMerge macro (see URL above). The information for each record is
properly saved as an individual document, with the page orientations
intact. However, the images are not updated and all documents show the
same images from the first record. To display the correct images I have
to open each document individually and then press Ctrl+A and F9.

Is it possible to automatically update the images before the merged
document is split into individual files?

Many thanks for your help.
 
D

Doug Robbins - Word MVP

From the Tools menu, select Templates and add-ins and uncheck the box
against the MMtoDocsRev18 item. Then exit from that dialog and open that
template. With the template open, press Alt+F11 to open the Visual Basic
Editor and under the TemplateProject (MMtoDocsRev18) Project, expand the
Class Modules folder and select the MergeApplication. In the code window on
the right, scroll down to the Private Sub app_MailMergeAfterMerge(ByVal Doc
As Document, ByVal DocResult As Document) and add the following line of code

NewDoc.Range.Fields.Update

immediately before

NewDoc.SaveAs FldrPath & fnames(i)

Go back to the Word Document window and save the template and close it.
Then in the Templates and add-ins dialog, place a check mark against the
MMtoDocsRev18 item.

Now when you execute the merge to a new document and accept the Merge to
Individual Documents option, the image fields should be updated.

Post back here with the results.

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP
 
G

Graham Mayor

That works! I have updated the downloadable version - now MMtoDocsRev19

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


<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 
D

Doug Robbins - Word MVP

Thanks, Graham.

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - 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