Share via

Conditional Image insertion based on Merge Data

Anonymous
2015-02-25T19:08:23+00:00

Hello, all. I am trying to insert a logo into a mail merge document based on the list ID that the data originated from.

Specifically, I have 3 data sources that were combined into one and once that list is processed and returned with data from all 3 lists, the list id tells me which list the data came from, and therefore, which logo should be inserted in the merged document.

The original CSV file does not contain the logo or image link. These are being stored on the PC and I want to pull them in based on the list ID in the CSV file.

For this action, I am using 

{INCLUDEPICTURE "{IF TRUE "C:\Users\kara\Documents\My Circulation\Renewals\{Mergefield LIST_ID}.png"}" \d }

Where the images are named according to the list id, ie. 1882.png.

When I go to preview my results, an image placeholder appears and tell me that it cannot find the file. What am I doing wrong? THANK YOU!

Microsoft 365 and Office | Word | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

5 answers

Sort by: Most helpful
  1. Anonymous
    2015-02-26T16:01:45+00:00

    After a lot of tweaking, I finally got this to work. Thank you for your assistance!

    Was this answer helpful?

    0 comments No comments
  2. Anonymous
    2015-02-26T14:31:56+00:00

    Thank you for your help. I copied and pasted the path, as directed, and my path is correct. I also tried the construction above, and got the same result as when I tried it with what I posted.

    The images are:

    1886.png

    792.png

    2012.png

    The path is: C:\Users\kara\Documents\My Circulation\Renewals

    The construction used:

    {IF {INCLUDEPICTURE {IF TRUE "C:\Users\kara\Documents\My Circulation\Renewals\{Mergefield LIST_ID}.png"} \d} {INCLUDEPICTURE {IF TRUE "C:\Users\kara\Documents\My Circulation\Renewals\{Mergefield LIST_ID}.png"} \d} }

    Was this answer helpful?

    0 comments No comments
  3. Doug Robbins - MVP - Office Apps and Services 323.1K Reputation points MVP Volunteer Moderator
    2015-02-26T03:15:01+00:00

    Try using the following construction

    {IF {INCLUDEPICTURE {IF TRUE "C:\Users\kara\Documents\My Circulation\Renewals\{Mergefield LIST_ID}.png"} \d} {INCLUDEPICTURE {IF TRUE "C:\Users\kara\Documents\My Circulation\Renewals\{Mergefield LIST_ID}.png"} \d}}

    Another thing to check, in File Explorer, go to the Renewals folder and right click on the Address Bar and select "Copy address as text" and paste that into a document and compare it with the path in the field construction (It will of course not have the double field separators, but otherwise, it will need to be identical.

    Was this answer helpful?

    0 comments No comments
  4. Anonymous
    2015-02-26T02:26:57+00:00

    Yes. The images are named  972.png, 2012.png and 1774.png. The list id field has those same numbers. Minus the .png

    Was this answer helpful?

    0 comments No comments
  5. Doug Robbins - MVP - Office Apps and Services 323.1K Reputation points MVP Volunteer Moderator
    2015-02-26T02:15:55+00:00

    Does the «LIST_ID» mergefield contain the filename (without the extension) of the graphics?  It will need to be an exact match.

    Was this answer helpful?

    0 comments No comments