Includepicture field in a mailmerge

S

sot

I have an excel list that has a dexcription field, a price field and a photo
field. The photo field has the name of an image file in it.

I am using the Word Mailmerge Catalog command. I need to know the syntax of
the Includepicture with the mergefield command.

Many thanks
 
P

Peter Jamieson

If the field just has the name of the file, you will probably need to
supply the pathname. Use double backslashes or single forward slashes as
the path separator, e.g. something like

{ INCLUDEPICTURE "c:\\mypics\\{ MERGEFIELD photofilename }" }

substitute /your/ folder pathname and merge field name. All the {} have
to be the special "field code braces" that you can insert using ctrl-F9.

You will probably also find that you need to select the output document,
select it, and press F9 to update all the images.

If your field has the complete pathname, you /probably/ won't be able to use

{ INCLUDEPICTURE "{ MERGEFIELD photopathname }" }

as you might hope, unless the pathname has double backslashes or single
forward slashes as path separators.
You may also find inserting a \d switch helpful, e.g.

{ INCLUDEPICTURE "c:\\mypics\\{ MERGEFIELD photofilename }" \d }


Peter Jamieson

http://tips.pjmsn.me.uk
 
M

macropod

Hi Peter,

If the path has only the single slashes, you should be able to use:
{INCLUDEPICTURE "{QUOTE{MERGEFIELD photofilename}}"}
 
P

Peter Jamieson

Thanks!

FWIW I decided to recheck a number of variations on how you might insert
a path+filename, e.g.
a. the entire pathname is in a merge field

{ INCLUDEPICTURE "{ MERGEFIELD fullpathname }" }

b. the enclosing folder path with teminating separator, and the
filenam are in two merge fields

{ INCLUDEPICTURE "{ MERGEFIELD pathwithsep }{ MERGEFIELD filename }" }

c. the enclosing folder path without a terminating separator, and the
file name are in two merge fields, with a literal separator

{ INCLUDEPICTURE "{ MERGEFIELD pathwithoutsep }\\{ MERGEFIELD filename }" }

d. the path is a literal string, but the filename is in a field

{ INCLUDEPICTURE "c:\\mypath\\{ MERGEFIELD filename }" }

and tried fullpathname, pathwithsep, pathwithoutsep, with single
backslash, double backslash, single forward slash, with the equivalent
separators inserted manually in cases (c) and (d).

Interestingly enough, with all three types of separator, type (a) worked
OK in Word 2k+Win2k, Word XP+WinXP, Word 2003+Win XP and Word
2007+Vista. (and Word 95+Win2k, for that matter)

On all those four versions of Word, all the other combinations worked as
well, except
(c) with single backslashes and
(d) with single backslashes

Even (c) with single backslashes worked if you used a double backslash
literal after { MERGEFIELD pathwithoutsep } instead of a single
backslash literal. Just out of interest, when I tried wrapping the
fields+literals making up the full pathname in a QUOTE field, Word
didn't like it at all, typically either crashing Word (Word 2000), or
hanging Word in case (d) (I got fed up at that point and didn't check
any of the other cases :) ) Something that happened in Word 2007 -
probably after I had already corrupted th document in some way though,
suggested that Word code could well be trying to interpret a single
backslash + opening field code as an ordinary character, or some kind of
escape character, thus screwing up field code brace matching and
generally getting lost.


Best regards,

Peter Jamieson

http://tips.pjmsn.me.uk
 

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