IncludePicture and OnMerge: Mail
Merge Variable Images with Microsoft® Word
A
Tale of the
Easy Way and the Hard Way
Business documents
and emails – even informal ones – that
traditionally contained only text now routinely contain images and pictures.
Rising
expectations triggered by the falling prices of scanners, digital cameras
and color printers have moved images and photos squarely into the office
mainstream.
Today, letters routinely
contain scanned signatures and the sender’s
photo; reports of all sorts are backed up with included photos; internal phone
directories include photos; product lists often include photos; data
sheets include diagrams and schematics. The list goes on and on, but is often limited
because most offices use Microsoft Word's Mail Merge feature to generate
repetitive documents, yet few users know how to customize it to merge different
images. This article explains just that: how to merge variable images into
a Word document.
The
Hard Way: Basic Merge Procedure Using INCLUDEPICTURE
Microsoft Word naturally
includes little-known features to support mail-merging images into documents.
With a little bit of work, you can even customize the master document so
that different images are included in each merged document or page. Here's
a step-by-step guide to using that feature:
- The key to variable
images is to have a collection of photo or image files in a folder on your
computer or network, and to name the images files the same
as the contents of a field in the database. For example, if you have a database
which includes a “FirstName” field, you might name personnel photos “John.jpg,” “Mary.jpg,” and
so forth.
- If you're using
Word 2007 or Word 2010, Save As the document in the Word 97 - 2003 (.doc)
format -- NOT the Word 2007 (.docx) format. IncludePicture does not work
in .docx documents due to a bug in Word.
- If it’s not
already selected, select the data source (database) into the master document
you’ll
be working with. Also make sure that the Mail Merge toolbar is visible
in Word's menu bar; if not, enable it with Tools + Customize, and check
off the Mail Merge box.
- Locate where you
want to position your image, and insert an image from the image collection
(any of them will do for now) onto the page in the usual manner
using Insert
+ Picture + From File. However, do not press the Insert button as usual
after selecting the file. Instead, press the little triangle on the
right edge
of
that button to get a three-line menu, and click “Link to File.” Do
not format or resize the picture.
- You’re now
ready to make the image into a variable image. Press the Alt
+ F9 key
combination. The picture you just inserted will become something
like this on a gray background:
{ INCLUDEPICTURE “c:\\staff\\pictures\\John.jpg” \* MERGEFORMAT
\d }
Note that copying and pasting the above text from this article into
Word will not work; you must carry out this procedure as-is.
- Select and delete
the filename portion, but leave the folder name(s) with the
backslashes, and
leave the
file’s “extension” (.jpg in this case, might
be .gif, .bmp, .tif or other). In this example we’ll
only remove “John” and
the line will now look something like:
{ INCLUDEPICTURE “c:\\staff\pictures\\.jpg” \* MERGEFORMAT
\d }
- Leaving the cursor
where “John” used to be, select the Insert
Merge Fields button from the Mail Merge toolbar (typically the
fifth button from the left), and select the database field you need. In this
example, you’d
get:
{ INCLUDEPICTURE “c:\\staff\\pictures\{ MERGEFIELD “FirstName” }.jpg” \*
MERGEFORMAT \d }
- Press Alt
+ F9 again
to go back to Picture View so that you can view your handiwork.
- Run the [for
Word 2007/10: Mailings, Finish & Merge, Edit Individual
Documents] or
[for Word 2003 and XP: Merge to New
Document] (not to a printer,
fax or e-mail).
- Select the new document;
Press Ctrl + A; Press F9.
Working Around INCLUDEPICTURE Image Size Problems
The images in the merged
document will probably be the wrong size. Do not attempt to change the picture’s size in the original document. If you
do so, the change will appear to work, but Word will change it back to the
incorrect size as soon as you do a merge. To put it politely, this is one of
Word’s quirks: whenever it merges in a new image, Word resets the image’s
size to its “natural” size. That’s just the way Word works,
so you must work around it.
There are three ways to
work around the image-size quirk: (a) change all original images’ size
to the desired “natural” size using Photo Editor or similar software, (b)
manually resize all images in the resulting document after the merge is
done, or (c) see “The Easy Way...” below
for another kind of solution. Those are the only known options, aside from
picketing
Microsoft
headquarters.
Beware Missing Images
The other thing you may
have noticed on your printed page is that some of your images are missing,
with a box containing a red X in their place. That is what
Word does if the database look-up comes up with a file name which doesn’t
exist. There’s no way to get rid of the red X except to give Word what
it wants: an image file. If you don't want an occasional red X,
you can either (a) fix your database if the data is genuinely incorrect, or
(b) create suitably-named all-white "dummy" image files for each missing name
using Photo Editor or other program.
The data you’re
testing with may not have missing image files, but be aware that missing
images may occur when you roll out your master document with a larger database.
It’s important to take steps to check data to make sure that it’s
clean, or that there are dummy files for all missing names.
Checklist Summary
Admittedly, INCLUDEPICTURE
can difficult to use, but can be very rewarding. Here is a summary of the
basic steps for successful variable image mail-merging:
- Rename image files to match the database (or change the database to
match images);
- Setup coding
of merge fields using a database;
- Resize each image
file to the correct size;
- Check and scrub
the database of names that don’t have corresponding
image files (or create dummy blank images);
- Run the Merge
to New Document;
- In the new document, press Ctrl + A followed by F9
The
Easy Way: There
Is a Shortcut
If you don't want to deal
with all of the above or if you need to merge directly to e-mail, fax or
a printer, there is a new and inexpensive Word Add-in called OnMerge Images
which automates
mail-merging variable images.
Add-ins are small third-party programs which extend Word's power without
disturbing Word's familiar features. OnMerge Images creates variable images
with a simple dialog box, automatically works around all of Word’s
quirks, and lets you do things that are virtually impossible with INCLUDEPICTURE.
Those extras
include:
- completely eliminate manual INCLUDEPICTURE coding,
- merge directly to e-mail, fax and printer,
- automatically resize each merged
image to fit a specific box size without “squishing” the
image nor resizing the original,
- optionally skip or blank-out missing images,
- optionally merge only database records with valid images,
- warn if an image is missing, and
- compose an image file name from multiple database fields (such as FirstName
+ LastName).
Does
the add-in truly make variable images easy? Yes – our experience is
that anyone familiar with photos and with basic mail-merging
can merge variable images in a few minutes using OnMerge Images.
You can find out more
about OnMerge Images, watch a video of the add-in in action, and download
a free trial version from OnMerge’s
website at www.OnMerge.com.