Mail Merge With Variable Pictures Using Word 2013

I have been experimenting and researching for several days to figure out how to do a Mail Merge that includes variable I edited my original post after finding very helpful tips from Paul, Doug, and Graham. I’m preparing a merge document that will be manually e-mailed to parents who have a child enrolled in a preschool. My screen shots have information blocked for privacy. I have to add FN into my hotkey combinations for them to work with my keyboard. Do not use FN if your keyboard does not require you to press it to activate the function keys.

Main Document: My main document includes merge fields for a child’s name and child’s picture.

Data Source: I used two fields in an Excel data source file: "Pic" to hold the names of each picture and "Path" to hold the name of the path to that *jpg picture. Note the paths include double backslashes. Make sure you have added them in the same pattern for your path. I advise keeping picture names short with no spaces. 

 

  1.       Reconnect to your Data Source file: from the Start Mail Merge group, click Select Recipients, Use an Existing List, browse to your Excel Data Source file. [I think if you wait to do this until after step 17, you get the error with the link to picture not working.]
  2.       Press FN+ALT+F9 to display field codes.
  3.       Click in the square in the banner on the right where the picture will be inserted:
    1.       Press CTRL+FN+F9 to insert a pair of field boundaries.
    2.       Click directly after the first opening field boundary and type INCLUDEPICTURE; click just after the first space following the typed text.
    3.       Press CTRL+FN+F9 to insert a second pair of field boundaries.
    4.       Click directly after the second opening field boundary, and type IF TRUE; click just after the first space following the typed text; type " (quotation marks).
    5.       From the MAILINGS tab, Write & Insert Fields group, click Insert Merge Field list arrow; click Path.
    6.        Type / (a forward slash).
    7.       From the MAILINGS tab, Write & Insert Fields group, click Insert Merge Field list arrow; click Pic.
    8.       Type " (quotation marks).
    9.        Delete the space after the quotation marks you just typed and the closing field boundary.
    10.        Click just before the last closing filed boundary; type \d (backslash d).
      1.       The field should look like this:

  1.       Reconnect to your Data Source file: from the Start Mail Merge group, click Select Recipients, Use an Existing List, browse to your Excel Data Source file just to be sure you’re linked. Save the file.
  2.       Press FN+ALT+F9 to toggle field code display off.
  3.       From the MAILINGS tab, Preview Results group, click Preview Results.
  4. From the MAILINGS tab, Finish group, click the Finish & Merge button; click Send Email Messages.


Was this discussion helpful?

Sorry this didn't help.

Great! Thanks for your feedback.

How satisfied are you with this discussion?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this discussion?

Thanks for your feedback.

* Please try a lower page number.

* Please enter only numbers.

* Please try a lower page number.

* Please enter only numbers.

I don't know why anyone would say it isn't possible or that the .doc format is required. Neither proposition is true.

To insert variable images in a mailmerge, you need to embed the relevant mailmerge field in a INCLUDEPICTURE field. However, there are some issues with this that make the process less straightforward than one might expect. For example, when embedding a mailmerge field in an INCLUDEPICTURE field for the purpose of merging graphics:
1. the file paths to the fields need to have the separators expressed as '\\' or '/' instead of the usual '\';
2. the pictures usually won't show until you refresh the fields (eg Ctrl-A, then F9) in the output document after completing the merge; and
3. even after updating the images, they remain linked to the image files, which can be an issue if you later delete the image or you need to send the merged output to someone else.
 
The following field construction addresses all three issues (i.e. you don't need to do anything special to the paths, or refresh the fields, and they'll no longer be linked to the source files):
{IF{INCLUDEPICTURE {IF TRUE "C:\Users\My Document Path\Pictures\«Image»"} \d} {INCLUDEPICTURE {IF TRUE "C:\Users\My Document Path\Pictures\«Image»"} \d}}
or:
{IF{INCLUDEPICTURE {IF TRUE "C:\Users\My Document Path\Pictures\{MERGEFIELD Image}"} \d} {INCLUDEPICTURE {IF TRUE "C:\Users\My Document Path\Pictures\{MERGEFIELD Image}"} \d}}
After running a mailmerge coded this way, you'll have the correct, unlinked image for each record.

This form of field construction can be very useful where the filepath for the images is held in the mailmerge data source, in which case you could use:
{IF{INCLUDEPICTURE {IF TRUE "«FilePath»\«Image»"} \d} {INCLUDEPICTURE {IF TRUE "«FilePath»\«Image»"} \d}}
or:
{IF{INCLUDEPICTURE {IF TRUE "{MERGEFIELD FilePath}\{MERGEFIELD Image}"} \d} {INCLUDEPICTURE {IF TRUE "{MERGEFIELD FilePath}\{MERGEFIELD Image}"} \d}}
 
Note 1: You need a path separator between the filepath mergefield and the image mergefield. If that separator is included in the source data, it can be omitted from the field above construction but leaving it there has no adverse effects
either.
 
If you can be sure the pictures will always be in the same folder as the mailmerge main document, you can incorporate a FILENAME field thus:
{IF{INCLUDEPICTURE {IF TRUE "{FILENAME \p}\..\{MERGEFIELD Image}"} \d} {INCLUDEPICTURE {IF TRUE "{FILENAME \p}\..\{MERGEFIELD Image}"} \d}}
or:
{IF{INCLUDEPICTURE {IF TRUE "{FILENAME \p}\..\«Image»"} \d} {INCLUDEPICTURE {IF TRUE "{FILENAME \p}\..\«Image»"} \d}}
 
If the path data are included with in the image field, you can use:
{IF{INCLUDEPICTURE {IF TRUE «Image»} \d} {INCLUDEPICTURE {IF TRUE «Image»} \d}}
or:
{IF{INCLUDEPICTURE {IF TRUE {MERGEFIELD Image}} \d} {INCLUDEPICTURE {IF TRUE {MERGEFIELD Image}} \d}}
For what it's worth, *provided* the path has the separators expressed as '\\' or '/', you can retain the links by omitting the all-encompassing IF test and the images will display correctly without the need to refresh the fields after completing the merge. For example:
{INCLUDEPICTURE {IF TRUE "C:\\Users\\My Document Path\\Pictures\\«Image»"} \d}

Note 2: The field brace pairs (i.e. '{ }') for the above example are created in the document itself, via Ctrl-F9 (Cmd-F9 on a Mac); you can't simply type them or copy & paste them from this message. Nor is it practicable to add them via any of the standard Word dialogues. Likewise, you can't type or copy & paste the chevrons (i.e. '« »') - they're part of the actual mergefields, which you can insert from the mailmerge toolbar. The spaces represented in the field construction are all required.

Cheers
Paul Edstein
(Fmr MS MVP - Word)

24 people found this reply helpful

·

Was this reply helpful?

Sorry this didn't help.

Great! Thanks for your feedback.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this reply?

Thanks for your feedback.

Thank you, Paul. However, I doubt I would be able to follow your directions to test the steps. That said, I'm sure there are others out there with enough familiarity with all those lines of codes you included and know Word merge enough to copy/paste or do whatever needs doing to get the merge to work. In any case, hopefully my post and yours are valuable to others. I didn't find anything relevant or recent in this regard when I searched the Microsoft Community. This is not a common application for Word merge and I own many Word books--none of them even mentioned it.
Arlene

13 people found this reply helpful

·

Was this reply helpful?

Sorry this didn't help.

Great! Thanks for your feedback.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this reply?

Thanks for your feedback.

I've posted the same advice (and variations of it) here and on other forums numerous times, and others have posted similar advice too. See also: http://www.gmayor.com/mail_merge_graphics.htm
Cheers
Paul Edstein
(Fmr MS MVP - Word)

2 people found this reply helpful

·

Was this reply helpful?

Sorry this didn't help.

Great! Thanks for your feedback.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this reply?

Thanks for your feedback.

See the following pages of fellow MVP Graham Mayor's website:

Mail merge graphics at http://www.gmayor.com/mail_merge_graphics.htm

and Mail Merge Graphics Add-In at http://www.gmayor.com/mail_merge_graphics_addin.htm

Hope this helps,
Doug Robbins - MVP Office Apps & Services (Word)
dougrobbinsmvp@gmail.com
It's time to replace ‘Diversity, Equity & Inclusion’ with ‘Excellence, Opportunity & Civility’ - V Ramaswamy

1 person found this reply helpful

·

Was this reply helpful?

Sorry this didn't help.

Great! Thanks for your feedback.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this reply?

Thanks for your feedback.

Paul--a question on your steps:


You say,

"For what it's worth, *provided* the path has the separators expressed as '\\' or '/', you can retain the links by omitting the all-encompassing IF test and the images will display correctly without the need to refresh the fields after completing the merge. For example:

{INCLUDEPICTURE {IF TRUE "C:\\Users\\My Document Path\\Pictures\\«Image»"} \d}

Note 2: The field brace pairs (i.e. '{ }') for the above example are created in the document itself, via Ctrl-F9 (Cmd-F9 on a Mac); you can't simply type them or copy & paste them from this message. Nor is it practicable to add them via any of the standard Word dialogues. Likewise, you can't type or copy & paste the chevrons (i.e. '« »') - they're part of the actual mergefields, which you can insert from the mailmerge toolbar. The spaces represented in the field construction are all required."

When you say "mailmerge toolbar," are you referring to the MAILINGS tab? I cannot find the chevrons anywhere on that tab. If I insert merge fields for my Pic field, I get the field brace pairs, not chevrons. I think this is what corresponds to your example in my case. 


Thank you in advance for any help.

PS:--oh happy days--just got it to work with this:

Arlene

1 person found this reply helpful

·

Was this reply helpful?

Sorry this didn't help.

Great! Thanks for your feedback.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this reply?

Thanks for your feedback.

When you say "mailmerge toolbar," are you referring to the MAILINGS tab? I cannot find the chevrons anywhere on that tab. If I insert merge fields for my Pic field, I get the field brace pairs, not chevrons. I think this is what corresponds to your example in my case. 

As I said, the chevrons (i.e. '« »') are part of the actual mergefields. They're part of what normally gets generated when you insert a mergefield from the mailmerge toolbar. If you choose the 'Pic' field, for example, in the document you'll normally see «Pic».

In your unedited reply, you also showed a worksheet with paths expressed as 'C\\Users\\Arlene\\Desktop\\GPMPics'. Since it appears all the records use the same path, the path doesn't need to be in the datasource and can instead be part of the field construction, as per the first set of examples in my first reply.

What you now have working will generate a mailmerge output with the pictures still linked to the source files. That's OK provided you aren't sending the document to anyone who doesn't have access to your desktop and provided you don't delete the pictures from there. The more extensive field construction in my post breaks those links. You can also do that manually, post-merge, by Ctrl-A, Ctrl-Shift-F9.

Cheers
Paul Edstein
(Fmr MS MVP - Word)

Was this reply helpful?

Sorry this didn't help.

Great! Thanks for your feedback.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this reply?

Thanks for your feedback.

I e-mailed all the merged documents to various addresses and all pictures opened without issue. So with your helpful tips, I think we can consider this one as "case closed." The merge was successful and all files with variable pictures were received without issue.

In regard to adding the path field with the double backslashes, I found that much simpler to do than typing all of that into the merge field area. In terms of the chevrons, you can see that my merge fields don't insert themselves with chevrons--they use the field boundaries that look like braces. In any case, what I have now works, so I guess I don't need to worry about where to find chevrons. 

Thanks again, Paul. I wanted to mark your post as an answer but I guess discussions don't have that option.

Arlene

Was this reply helpful?

Sorry this didn't help.

Great! Thanks for your feedback.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this reply?

Thanks for your feedback.

Hi there

I am new to the forum, so not sure if this has been closed or not?

I am trying to insert from an excel file different pictures, using this:

 { INCLUDEPICTURE { IF TRUE {MERGEFIELD "Entryjpg" } } \d }

The cell that contains the different mailmerge JPGs is as follows in the excel file:

"C:\\Users\\G\\Documents\\iPMP Test\\CDF0411115555235942_458181_20140803000253.jpg"

When I try to merge, I am getting the red X and comment of the linked image cannot be displayed

I cannot see where this is going wrong?

Any help would be greatly appreciated...


1 person found this reply helpful

·

Was this reply helpful?

Sorry this didn't help.

Great! Thanks for your feedback.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this reply?

Thanks for your feedback.

It could be an issue with the length of the path\filename for the images.
Hope this helps,
Doug Robbins - MVP Office Apps & Services (Word)
dougrobbinsmvp@gmail.com
It's time to replace ‘Diversity, Equity & Inclusion’ with ‘Excellence, Opportunity & Civility’ - V Ramaswamy

1 person found this reply helpful

·

Was this reply helpful?

Sorry this didn't help.

Great! Thanks for your feedback.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this reply?

Thanks for your feedback.

Hi Paul, 

I have seen your comment on this issue on a number of thread and I have tried to make it work. I am using the extended version to try and address the 3 points you mention. Here is an example of one of my statement: 

{IF {INCLUDEPICTURE {IF TRUE "{ MERGEFIELD PictureLocation }"} \d}{ INCLUDEPICTURE {IF TRUE "{ MERGEFIELD PictureLocation }"} \d}}

(Note: The "MERGEFIELD PictureLocation" contains the filepath and image name)

This works and indeed addresses the first two points. But after the merge is complete and pictures can be seen, when I then save the merged file and reopen, or if I change the location of the merged file and reopen, it no longer displays the picture but instead shows:

{ INCLUDEPICTURE \d"C:\\Users\\temborowski\\Desktop\\Picture Mail Merge\\Picture Library\\cycle length.jpg"\* MERGEFORMATINET }

Any ideas why and how to resolve?

Thanks,

Temi

4 people found this reply helpful

·

Was this reply helpful?

Sorry this didn't help.

Great! Thanks for your feedback.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this reply?

Thanks for your feedback.

* Please try a lower page number.

* Please enter only numbers.

* Please try a lower page number.

* Please enter only numbers.

 
 

Discussion Info


Last updated March 7, 2024 Views 77,448 Applies to: