View Single Post
  #4   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Peter Jamieson Peter Jamieson is offline
external usenet poster
 
Posts: 4,582
Default Includepicture field in a mailmerge

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

macropod wrote:
Hi Peter,

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