View Single Post
  #14   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Peter Jamieson Peter Jamieson is offline
external usenet poster
 
Posts: 4,582
Default How to add a condition in an includepicture with mergefield

At one time, INCLUDEPICTURE fields used to update with much less
intervention than they do now (if I remember correctly). Then MS noticed
that malware could theoretically use Word fields to grab data from other
parts of a user's system, insert it into a Word document, and capture it. So
it altered the behaviour of a number of types of fields, and allowed some
control over the behaviour of these fields using the registry key
"FieldCalcSecurityLevel"

There's a description of some of this in the following KB article:

http://support.microsoft.com/kb/330079/en-us

One of the things that it mentions is that the behaviour of the
INCLUDEPICTURE field differs depending on whether or not you included the \d
switch: if you include it, you are much more likely to see your pictures
updating because Word does not store the picture information in the .doc and
so it is less easy for malware to use that method to transmit infomation
about your system.

I say "may" simply because I have never tested all possible combinations of
e.g. Word version, registry settings, and so on, and other settings
generally also come into play. In short - it's one thing to make things work
on one system, with one version of Word, until some new update comes along,
but it's quite another thing to rely on that approach when you're trying to
roll out a reliable solution to end-users (perhaps hundreds or thousands).

So I doubt if the type of database you happen to be using to get your image
file names from is likely to be relevant, but it might be.

As for the whole business of extracting objects from Access databases, I'm
not one of the authors of Word or Access so can only speculate why they
didn't provide facilities to do it, but
a. the chances are that there is insufficient explicit demand from
corporate customers, and MS just decided to stick to supporting merging of
very simple data types.
b. as far as I know, MS has never published the details of how it
represents OLE objects within an MS Access database. It has published KB
articles that tell you how you can, in some cases, extract certain types of
object, but assuming they know the details of how objects are stored within
Jet databases, they keep that information to themselves. In addition, just
because you have an OLE object in an Access database does not mean that you
have an OLE/COM server on your system that is capable of rendering it. If
you don't, it may not even be possible to
"Anderflash" wrote in message
...
Graham, before I met this newsgroup, I had seen your site and I liked very
much about fields' math. Thanks for the knowledge.

I think your answer is for my second question, about ole object in Access
database to a mail merge.
And to my first question? Do I get the effect of change the photos
automaticaly by navigating between records in a mail merge with an Access
database or I only get the photos updated by merging to a new document?
If this is the normal behavior, the effect would be an interesting feature
to the new office, and also it would be very good if Word recognizes type
of
the Access fields, because imagine your mail merge with fields about
music,
like a mail merge about music player, you navigate from one record to
another
and listen different musics, or different videos, or different charts
without
using VBA...

"Graham Mayor" wrote:

This is normal behaviour - see
http://www.gmayor.com/mail_merge_graphics.htm

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org


Anderflash wrote:
Serafim, tell me what kind of database you're using to the mail merge,
because with an Access database, I can't update automaticaly the
pictures by navigating from one record to another, I see diferent
pictures only if I merge to a new document or to a printer. But if I
use a Word table as a source for my mail merge, I can.
And another question: If I put pictures inside an Ole object field in
a Access database, I can't throw them to the Word's mail merge, I can
throw only text (in this case, the Word will see a code like
130021230). Is there a solution?

Thanks

"Serafim" wrote:

Hi Macropod,

For my purposes I changed your instruction just a little and for my
surprise it works much better than I expected {INCLUDEPICTURE
{IF{MERGEFIELD photo}="" "X" {MERGEFIELD photo}.
It's not necessary to merge to printer, nor to merge to a new
document and Ctrl+A and F9. Itīs not even necessary to merge, if we
simply navigate from one record to another, the picture is updated.
The picture is always updated. I think it's great.

"macropod" escreveu:

Hi Graham,

Here's a workaround:
{INCLUDEPICTURE {IF{MERGEFIELD Num} 10 {MERGEFIELD MergePic}
NoMergePic}}
where 'NoMergePic' is the name of a file containing the 'no picture
for this record' string as an image.

For an apparently blank result, you could use a 1-pixel transparent
'NoMergePic'.

Cheers


"Graham Mayor" wrote in message
...
No - that doesn't work. During the merge to a new document the
picture from the conditional statement becomes hard wired into the
document and cannot be updated. I can't see a way round this at
the moment.


--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org


macropod wrote:
Hi tinous,

Try:
{IF{MERGEFIELD num} 10 {INCLUDEPICTURE {MERGEFIELD
beautifulpicture}}}

Cheers

"tinous" wrote in message
...
Hi,

I know how to add a varying picture in a mailmerge :
{INCLUDEPICTURE MERGEFORMAT {MERGEFIELD beautifulpicture}}
(and after the merge CRT A + PF9 to refresh)

I know how to add a condition to add or not a field using the "If
then else "
{IF {MERGEFIELD num} 10 {MERGEFIELD aaa} {MERGEFIELD bbb} }

What I want to do, now, is to mix the two and have
"beautifulpicture' added ony if num 10 .

If I code
{IF {MERGEFIELD num} 10 {INCLUDEPICTURE MERGEFORMAT {MERGEFIELD
beautifulpicture}} "no picture for this record" } the result is
not OK. (the same picture is added (always the first even after
CTR A + PF9)).

Is somebody can help me, please?

Thanks

--
tinous