View Single Post
  #17   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Peter Jamieson Peter Jamieson is offline
external usenet poster
 
Posts: 4,582
Default Merging pictures

With one or two provisos, how about the following for Word 2007?

{IF{INCLUDETEXT {IF TRUE "O:\\Pictures\\2009 Original Church
Pictures\\{MERGEFIELD Full_Name}"} \c Recover }= "Error! Not a valid
filename." "" {INCLUDEPICTURE {IF TRUE
"O:\\Pictures\\2009 Original Church Pictures\\{MERGEFIELD Full_Name}"}}}

Proviso 1 is that when the file does not exist, merge flags an error
that you cannot suppress AFAICS by setting .displayalerts to
wdAlertsNone - you have to select the third option in Auto Check for Errors.

Proviso 2 is...well, it's untested. I have been down a similar route
before, and if Word is forced to open large JPGs, it can be a very slow
process. I have a feeling that there was another problem, but that might
be the one that you have solved with your nifty { INCLUDEstuff { IF TRUE
pathname } } construction.

I don't know why Word 2007 comes up with an "Error! Not a valid
filename." error in this case. The pathname looks OK to me, unless Word
doesn't like the double backslashes in this case. Word 2000 at least
seems to return the expected "Error! Cannot open file."

BTW when I use either this

{IF{INCLUDEPICTURE {IF TRUE "O:\\Pictures\\2009 Original Church
Pictures\\{MERGEFIELD Full_Name}"}}= "" "" {INCLUDEPICTURE {IF TRUE
"O:\\Pictures\\2009 Original Church Pictures\\{MERGEFIELD Full_Name}"}}}

or this

{IF{INCLUDEPICTURE {IF TRUE "O:\\Pictures\\2009 Original Church
Pictures\\{MERGEFIELD Full_Name}"}} "" {INCLUDEPICTURE {IF TRUE
"O:\\Pictures\\2009 Original Church Pictures\\{MERGEFIELD Full_Name}"}}}

in either 2007 or 2000 it always leaves /a/ picture in the output
document when the file is missing. In 2007 it's the same as the previous
successfully inserted picture as discussed, but in 2000 it's a square
blank picture or perhaps a placeholder. If you're finding that nothing
is inserted in pre-2007 Word when the file is missing I wonder why
there's a behaviour difference? When the file is present, the
construction works exactly as you say.


Peter Jamieson

http://tips.pjmsn.me.uk

macropod wrote:
Hi colblip,

If, as I am now beginning to suspect, you don't have a field in your
data for the image names and you're simply relying on a field that
contains the peoples' names (ie 'Full_Name'), then a field-based
solution isn't possible with Word 2007. For previous versions you could
use:
{IF{INCLUDEPICTURE {IF TRUE "O:\\Pictures\\2009 Original Church
Pictures\\{MERGEFIELD Full_Name}"}}= "" "" {INCLUDEPICTURE {IF TRUE
"O:\\Pictures\\2009 Original Church Pictures\\{MERGEFIELD Full_Name}"}}}