Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

if then else for includepicture

98 views
Skip to first unread message

Nicholas

unread,
Dec 30, 2009, 5:26:01 PM12/30/09
to

I am trying to use the includepicture syntex..
{INCLUDEPICTURE "{IF TRUE "E:\\Temp\\{Mergefield FirstName}{Mergefield
LastName}.jpg"}" \d }

However, what I am looking for, is if I don't have a picture, then I want it
to use a default picture as in e:\temp\default.jpg. How can I do this.

Thanks in advance.

Peter Jamieson

unread,
Dec 31, 2009, 10:40:55 AM12/31/09
to
I don't believe there's a known, reliable "fields only" solution for
this, at least on a "standard " installation. Your best bets are:
a. if possible, modify the data source, or pre-process the data source
so that each row contains the path of the image you need to insert,
using e:\temp\default.jpg where necessary
b. use VBA and Word Mailmerge events to check whether the file exists,
then insert the default if it does not.

If you want to pursue either of those, please verify that your
environment does not prevent a solution that uses e.g. database or VBA
programming, then let us know which version of Word you are using and
what the data source is.

Peter Jamieson

http://tips.pjmsn.me.uk

Miles

unread,
Dec 31, 2009, 12:02:01 PM12/31/09
to
There was some discussion of that in this forum years ago (search this forum
for "includetext conditional," result for 3/15/2006). The solution isn't very
reliable and you will see an error message box every time the file doesn't
exist, but the idea was something like:

{IF {INCLUDETEXT "{IF TRUE "E:\\Temp\\{Mergefield FirstName}{Mergefield
LastName}.jpg"}" } = "File is not available" { INCLUDEPICTURE
"e:\\temp\\default.jpg" \d } {INCLUDEPICTURE "{IF TRUE "E:\\Temp\\{Mergefield

FirstName}{Mergefield LastName}.jpg"}" \d } }

I haven't tested this myself, but there it is if it helps.

There is also a commercial add-in that entirely solves the problem named
OnMerge

--Miles

0 new messages