During a mail merge, how do I {IncludePicture} while in an {IF..}

J

Jeff O.

I get the picture included that I want during a mail merge so long as the
{IncludePicture} does not appear within the body of truetext or falsetext
where truetext and falsetext are defined by {IF condition "truetext"
"falsetext"}.

Any suggestions for getting the conditional results I want?? I'm trying to
keep this simple and not use Visual Basic.

Thanks, Jeff
 
D

Doug Robbins - Word MVP

Have you tried updating the fields in the document produced by executing the
merge to a new document?

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP
 
J

Jeff O.

Yes. This works so long as {IncludePicture} is not contained within the
"truetext" or "falsetext" of an {IF} field.

In the produced document, for those pictures included via merge within an
{IF} field, there are no links to update. I do get the first picture
referenced repeated instead of the pictures I want, but no links. Is there
some way to retrieve these underlying links so they can be updated?

It took me a long time to narrow this problem down to the {IF} field. My
theory is that Word is having trouble parsing the quotes. Are there
different delimiters that can be used instead of quotes for {IF},
{INCLUDEPICTURE}, or {MERGEFIELD}? Is there another way to jump on a
comparison?? (I tried jumping over the information I didn't want merged by
jumping to a bookmark, but I couldn't get this to work either.)

I hope you will try this for yourself to see how {INCLUDEPICTURE} works
differently inside versus outside an {IF} field. Any suggestions you have
would be greatly appreciated.

Thanks, Jeff
 
C

Cindy M -WordMVP-

Hi =?Utf-8?B?SmVmZiBPLg==?=,

In my experience, it generally does work. Could you please show us an IF field
combination where you're seeing the problem? And which version of Word are we
dealing with?
Yes. This works so long as {IncludePicture} is not contained within the
"truetext" or "falsetext" of an {IF} field.

In the produced document, for those pictures included via merge within an
{IF} field, there are no links to update. I do get the first picture
referenced repeated instead of the pictures I want, but no links. Is there
some way to retrieve these underlying links so they can be updated?

It took me a long time to narrow this problem down to the {IF} field. My
theory is that Word is having trouble parsing the quotes. Are there
different delimiters that can be used instead of quotes for {IF},
{INCLUDEPICTURE}, or {MERGEFIELD}? Is there another way to jump on a
comparison?? (I tried jumping over the information I didn't want merged by
jumping to a bookmark, but I couldn't get this to work either.)

I hope you will try this for yourself to see how {INCLUDEPICTURE} works
differently inside versus outside an {IF} field. Any suggestions you have
would be greatly appreciated.

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 8 2004)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or
reply in the newsgroup and not by e-mail :)
 
J

Jeff O.

Word version is Word 2003 (11.6502.6360) SP1
Part of Microsoft Office Professional Edition 2003.

THIS WORKS: (Produces a dynamically linked picture above and the ### +
variable filename below)
-----------------------------------------------------------------------------------------
{ INCLUDEPICTURE " { MERGEFIELD "SubSystem_Picture_1}"}
{ IF { MERGEFIELD "SubSystem_Picture_1" }<> "" " ### { MERGEFIELD
"SubSystem_Picture_1" } \* MERGEFORMAT }
Figure { STYLEREF 1 \s } { SEQ Figure \* ARABIC \s 1 } { MERGEFIELD
Subsystem_Picture_1_Caption } " "NO PICTURE 1" }
-----------------------------------------------------------------------------------------

THIS DOES NOT WORK: (inserts a static, non-linked picture during the merge
as if the first picture was pulled into the main document before merge
execution began)
-----------------------------------------------------------------------------------------
{ IF { MERGEFIELD "SubSystem_Picture_1" }<> "" "{ INCLUDEPICTURE " {
MERGEFIELD "SubSystem_Picture_1" }" \* MERGEFORMAT }
Figure { STYLEREF 1 \s } { SEQ Figure \* ARABIC \s 1 } { MERGEFIELD
Subsystem_Picture_1_Caption } " "NO PICTURE 1" }
------------------------------------------------------------------------------------------

The Mergefield is a text filename with the complete path brought in from
Access. I've tried using "\\" and "\" in the path name, and there doesn't
seem to be any difference. I've also tried many variations, including with
and without MergeFormat, with and without the \d flag, with and without
formatting, locked and manual links, etc. No variation resulted in the
desired outcome.

Your help is truely appreciated.

Thanks, Jeff
 
C

Cindy M -WordMVP-

Hi =?Utf-8?B?SmVmZiBPLg==?=,

Aha; telling us the field is being unlinked (turned into static text) does give me
an idea. What happens if you select the entire field code set, then press Ctrl+F9
(insert a pair of field brackets around the selection and type QUOTE at the
beginning of this new, top-level field? (IOW, you're putting the whole thing in a
QUOTE field).
Word version is Word 2003 (11.6502.6360) SP1
Part of Microsoft Office Professional Edition 2003.

THIS WORKS: (Produces a dynamically linked picture above and the ### +
variable filename below)
-----------------------------------------------------------------------------------
------
{ INCLUDEPICTURE " { MERGEFIELD "SubSystem_Picture_1}"}
{ IF { MERGEFIELD "SubSystem_Picture_1" }<> "" " ### { MERGEFIELD
"SubSystem_Picture_1" } \* MERGEFORMAT }
Figure { STYLEREF 1 \s } { SEQ Figure \* ARABIC \s 1 } { MERGEFIELD
Subsystem_Picture_1_Caption } " "NO PICTURE 1" }
-----------------------------------------------------------------------------------
------

THIS DOES NOT WORK: (inserts a static, non-linked picture during the merge
as if the first picture was pulled into the main document before merge
execution began)
-----------------------------------------------------------------------------------
------
{ IF { MERGEFIELD "SubSystem_Picture_1" }<> "" "{ INCLUDEPICTURE " {
MERGEFIELD "SubSystem_Picture_1" }" \* MERGEFORMAT }
Figure { STYLEREF 1 \s } { SEQ Figure \* ARABIC \s 1 } { MERGEFIELD
Subsystem_Picture_1_Caption } " "NO PICTURE 1" }
-----------------------------------------------------------------------------------
-------

The Mergefield is a text filename with the complete path brought in from
Access. I've tried using "\\" and "\" in the path name, and there doesn't
seem to be any difference. I've also tried many variations, including with
and without MergeFormat, with and without the \d flag, with and without
formatting, locked and manual links, etc. No variation resulted in the
desired outcome.

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 8 2004)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or reply in
the newsgroup and not by e-mail :)
 
J

Jeff O.

I had high hopes, but no dice. I stripped the main document down to just
the following:
--------------------------------------------------------------------
{ IF { MERGEFIELD "SubSystem_Picture_1" }<> "" "{ INCLUDEPICTURE { QUOTE {
MERGEFIELD "SubSystem_Picture_1" } } }" "NO PICTURE 1"}
---------------------------------------------------------------------
And I tried using the {QUOTE} field everywhere that quotes appear above and
in every combination. The behaviour was exactly the same in all cases. Do
you have a version of Word where this works? Maybe I can find an old copy
somewhere. This is being run under XP if that makes any difference.

Any help you can offer would be greatly appreciated.

Thanks, Jeff
 
C

Cindy M -WordMVP-

Hi =?Utf-8?B?SmVmZiBPLg==?=,
I had high hopes, but no dice. I stripped the main document down to just
the following:
--------------------------------------------------------------------
{ IF { MERGEFIELD "SubSystem_Picture_1" }<> "" "{ INCLUDEPICTURE { QUOTE {
MERGEFIELD "SubSystem_Picture_1" } } }" "NO PICTURE 1"}
---------------------------------------------------------------------
And I tried using the {QUOTE} field everywhere that quotes appear above and
in every combination. The behaviour was exactly the same in all cases. Do
you have a version of Word where this works? Maybe I can find an old copy
somewhere. This is being run under XP if that makes any difference.
No, please re-read the instructions in my original message. You don't put a
QUOTE field wherever you see quotes. That's not the intention, and no where
did I say that. You put the QUOTE field AROUND the entire field set. Just
because the name of the field is "quote" doesn't mean you should try using it
like the symbols!

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 8 2004)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or
reply in the newsgroup and not by e-mail :)
 
J

Jeff O.

Thanks, but it still doesn't work. If you think of anything else, please let
me know.

Regards, Jeff
 
G

Graham Mayor

Try this workaround:

{ INCLUDEPICTURE { IF { Mergefield "SubSystem_Picture_1" } <> "" "D:\\My
Documents\\My Pictures\\{Mergefield "SubSystem_Picture_1" }" "D:\\My
Documents\\My Pictures\\Blank.jpg" } }

Blank.jpg is essentially what it says. Save a blank jpg image from (eg)
Windows Paint.
The paths will be determined by your filing system and what the field
contains

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


<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 
C

Cindy M -WordMVP-

Hi =?Utf-8?B?SmVmZiBPLg==?=,
If you think of anything else, please let
me know.
Well, Word tends to update fields from the inside out. In
very early versions of Word, you couldn't nest an
IncludePicture field in an IF field for this reason. Since
people naturally try to do this :), Microsoft altered the
behavior to a certain extent, but sometimes it does behave
differently than one would expect/wish.

"back in the day", we had to do this:

{ IncludePicture "{ IF { Mergefield x} <> "" "{ Mergefield
x }" "C:\\empty.bmp" }" }

the problem being, of course, that one doesn't necessarily
want to insert any graphic at all, in such a case... But if
it's very tiny, perhaps that won't be a problem?

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update
Jun 17 2005)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any
follow question or reply in the newsgroup and not by e-mail
:)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top