Mail Merge, Conditional INCLUDEPICTURE

  • Thread starter Thread starter Jan Kronsell
  • Start date Start date
J

Jan Kronsell

Hi NG

Im doing a mailmerge, using the If ...THen...Else field to insert a text, if
a mergefield has a certain value (1) and another if the value is different
from 1. But instead of inserting a text, I like to include a picture if the
value in the field is "1", and another picture if it is not "1".

Is there any way to obtain this?

Jan
 
You can do this easily. Insert each of the pictures in a document (using
Link to File). Alt+F9 to view the IncludePicture field code and make sure it
is correct. Then copy/paste each of the field codes into the correct
respective location in your IF field. You could insert the pictures
(IncludePicture fields) directly into the IF field, but this can be somewhat
confusing and feel really strange.

--
Suzanne S. Barnhill
Microsoft MVP (Word)
Words into Type
Fairhope, Alabama USA

Email cannot be acknowledged; please post all follow-ups to the newsgroup so
all may benefit.
 
Suzanne said:
You could
insert the pictures (IncludePicture fields) directly into the IF
field, but this can be somewhat confusing and feel really strange.

But if you want to try that, using CTRL+F9 for each pair of field boundaries
{} enter the following directly in your document:

{IF {Mergefield fieldname} = 1 "{IncludePicture
"c:\\path\\picturefilename1.jpg"}" "{IncludePicture
"c:\\path\\picturefilename2.bmp"}"}

Note the double slashes and quotes and substitute the correct data as
required

Merge to a new document then select that document CTRL+A and update F9 to
display the correct pictures

You could also insert pictures based on the content of your data file - see
http://www.gmayor.com/mail_merge_graphics.htm


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

My web site www.gmayor.com

<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 
Hi Graham et al,

If all the pictures have the same name, except for the number, which is
returned by your MERGEFIELD, another way would be:

{INCLUDEPICTURE "c:/path/picturefilename{MERGEFIELD fieldname}.jpg"}

Note, too, that you can use a single forward slash for the path separator
instead of double backslashes.

Cheers
 
Note that one of John's files was a JPEG and one a BMP. If the TrueText and
FalseText also involve mergefields, then it becomes a bit more complex.
Worse still, I found that when I wanted to use a photo if one was available
and otherwise print "NO PHOTO AVAILABLE," the only way I could get it to
work (despite lots of experimentation with swapping TrueText and FalseText,
etc.) was to create an image that said "NO PHOTO AVAILABLE" and use that
filename for the FalseText.

--
Suzanne S. Barnhill
Microsoft MVP (Word)
Words into Type
Fairhope, Alabama USA

Email cannot be acknowledged; please post all follow-ups to the newsgroup so
all may benefit.
 
Hi Suzanne

I tried you method, and it works, but only amlost. When I paste the
INCLUDEPICTURE fiels into the IF THEN ELSe field and show the picture in
stead of the code (by Pressing Shift+F9 on the now nested INCLUDEPICTURE
field), it displays the pciture as long as the field code for the If Then
Else fiels is still shown, but as soon as I press Shift+F9 on the outer
field (IF THE ELSE) the picture disappears, leaving only a square the size
of the picture with a small "pic not found" or whatever it is, icon in the
upper left corner.

Regards
Jan
 
This will certainly be the case in your mail merge main document because the
IF field is not getting any information about whether or not the condition
is met. When you create the merge, then it will have data from the specific
field in each record referenced by the mergefield.

--
Suzanne S. Barnhill
Microsoft MVP (Word)
Words into Type
Fairhope, Alabama USA

Email cannot be acknowledged; please post all follow-ups to the newsgroup so
all may benefit.
 
Off cause

Thank you.

Jan
Suzanne S. Barnhill said:
This will certainly be the case in your mail merge main document because
the
IF field is not getting any information about whether or not the condition
is met. When you create the merge, then it will have data from the
specific
field in each record referenced by the mergefield.

--
Suzanne S. Barnhill
Microsoft MVP (Word)
Words into Type
Fairhope, Alabama USA

Email cannot be acknowledged; please post all follow-ups to the newsgroup
so
all may benefit.
 
Back
Top