Reply
 
Thread Tools Display Modes
  #1   Report Post  
Posted to microsoft.public.word.mailmerge.fields
colblip colblip is offline
external usenet poster
 
Posts: 19
Default Merging pictures

Hello, All!
I have a directory I print for the church. In it I have insert a picture of
the family with the code {INCLUDEPICTURE "O:\\Pictures\\2009 Original Church
Pictures\\{ Mergefield "Full_Name"}.JPG" }. I would like to insert a
standard NoPictureAvailable.jpg file if there is no picture for the family
in question. Is there a way to do this?

Thanks,

Colonel Blip
E-mail: colonel.blip.at.bigfoot.com


  #2   Report Post  
Posted to microsoft.public.word.mailmerge.fields
macropod[_2_] macropod[_2_] is offline
external usenet poster
 
Posts: 2,059
Default Merging pictures

See my reply in microsoft.public.word.newusers. Please don't post the same question multiple times in different newsgroups - you can
post to multiple newsgroups simultaneously, if need be, so that an answer in one newsgroup propagates to all.

--
Cheers
macropod
[Microsoft MVP - Word]


"colblip" colonel.blip.at.bigfoot.com wrote in message ...
Hello, All!
I have a directory I print for the church. In it I have insert a picture of the family with the code {INCLUDEPICTURE
"O:\\Pictures\\2009 Original Church Pictures\\{ Mergefield "Full_Name"}.JPG" }. I would like to insert a standard
NoPictureAvailable.jpg file if there is no picture for the family in question. Is there a way to do this?

Thanks,

Colonel Blip
E-mail: colonel.blip.at.bigfoot.com


  #3   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Doug Robbins - Word MVP Doug Robbins - Word MVP is offline
external usenet poster
 
Posts: 8,832
Default Merging pictures

Use the following field construction:

{IF {INCLUDEPICTURE {IF TRUE "O:\Pictures\2009 Original Church Pictures\{
Mergefield "Full_Name"}.JPG"}} {INCLUDEPICTURE {IF TRUE "O:\Pictures\2009
Original Church Pictures\{ Mergefield "Full_Name"}.JPG"}} {INCLUDEPICTURE
{IF TRUE "O:\Pictures\2009 Original Church
Pictures\NoPictureAvailable.jpg"}} }

Note that only a single \ is used as the path separator in the above
construction.
--
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, originally posted via msnews.microsoft.com
"colblip" colonel.blip.at.bigfoot.com wrote in message
...
Hello, All!
I have a directory I print for the church. In it I have insert a picture
of the family with the code {INCLUDEPICTURE "O:\\Pictures\\2009 Original
Church Pictures\\{ Mergefield "Full_Name"}.JPG" }. I would like to insert
a standard NoPictureAvailable.jpg file if there is no picture for the
family in question. Is there a way to do this?

Thanks,

Colonel Blip
E-mail: colonel.blip.at.bigfoot.com


  #4   Report Post  
Posted to microsoft.public.word.mailmerge.fields,microsoft.public.word.newusers
colblip colblip is offline
external usenet poster
 
Posts: 19
Default Merging pictures

Hello, Doug!

Doug,

Tried the code as follows per your suggestion but result was no pictures in
merged file. Here is my code to be sure I didn't miss something:

{ IF { INCLUDEPICTURE {IF TRUE "O:\\Pictures\\2009 Original Church
Pictures\\{ Mergefield "Full_Name"}.JPG"} } { INCLUDEPICTURE {IF TRUE
"O:\\Pictures\\2009
Original Church Pictures\\{ Mergefield "Full_Name"}.JPG"} } { INCLUDEPICTURE
{ IF TRUE "O:\\Pictures\\2009 Original Church

Pictures\\NoPictureAvailable.jpg" } } }


Anything obviously messed up that I've missed?

You wrote on Thu, 6 Aug 2009 11:29:35 +1000:

DRW {IF {INCLUDEPICTURE {IF TRUE "O:\Pictures\2009 Original Church
DRW Pictures\{ Mergefield "Full_Name"}.JPG"}} {INCLUDEPICTURE {IF TRUE
DRW "O:\Pictures\2009 Original Church Pictures\{ Mergefield
DRW "Full_Name"}.JPG"}} {INCLUDEPICTURE {IF TRUE "O:\Pictures\2009
DRW Original Church Pictures\NoPictureAvailable.jpg"}} }

DRW Note that only a single \ is used as the path separator in the above
DRW construction.
DRW --
DRW Hope this helps.

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

DRW Doug Robbins - Word MVP, originally posted via msnews.microsoft.com
DRW "colblip" colonel.blip.at.bigfoot.com wrote in message
DRW ...
?? Hello, All!
?? I have a directory I print for the church. In it I have insert a
?? picture of the family with the code {INCLUDEPICTURE
?? "O:\\Pictures\\2009 Original Church Pictures\\{ Mergefield
?? "Full_Name"}.JPG" }. I would like to insert a standard
?? NoPictureAvailable.jpg file if there is no picture for the family in
?? question. Is there a way to do this?
??
?? Thanks,
??
?? Colonel Blip
?? E-mail: colonel.blip.at.bigfoot.com
??

With best regards, colblip. E-mail: colonel.blip.at.bigfoot.com


  #5   Report Post  
Posted to microsoft.public.word.mailmerge.fields,microsoft.public.word.newusers
Doug Robbins - Word MVP Doug Robbins - Word MVP is offline
external usenet poster
 
Posts: 8,832
Default Merging pictures

Note that I said:

Note that only a single \ is used as the path separator in the above.

You still have \\ as the path separator.

--
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, originally posted via msnews.microsoft.com
"colblip" colonel.blip.at.bigfoot.com wrote in message
...
Hello, Doug!

Doug,

Tried the code as follows per your suggestion but result was no pictures
in merged file. Here is my code to be sure I didn't miss something:

{ IF { INCLUDEPICTURE {IF TRUE "O:\\Pictures\\2009 Original Church
Pictures\\{ Mergefield "Full_Name"}.JPG"} } { INCLUDEPICTURE {IF TRUE
"O:\\Pictures\\2009
Original Church Pictures\\{ Mergefield "Full_Name"}.JPG"} } {
INCLUDEPICTURE { IF TRUE "O:\\Pictures\\2009 Original Church

Pictures\\NoPictureAvailable.jpg" } } }


Anything obviously messed up that I've missed?

You wrote on Thu, 6 Aug 2009 11:29:35 +1000:

DRW {IF {INCLUDEPICTURE {IF TRUE "O:\Pictures\2009 Original Church
DRW Pictures\{ Mergefield "Full_Name"}.JPG"}} {INCLUDEPICTURE {IF TRUE
DRW "O:\Pictures\2009 Original Church Pictures\{ Mergefield
DRW "Full_Name"}.JPG"}} {INCLUDEPICTURE {IF TRUE "O:\Pictures\2009
DRW Original Church Pictures\NoPictureAvailable.jpg"}} }

DRW Note that only a single \ is used as the path separator in the above
DRW construction.
DRW --
DRW Hope this helps.

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

DRW Doug Robbins - Word MVP, originally posted via msnews.microsoft.com
DRW "colblip" colonel.blip.at.bigfoot.com wrote in message
DRW ...
?? Hello, All!
?? I have a directory I print for the church. In it I have insert a
?? picture of the family with the code {INCLUDEPICTURE
?? "O:\\Pictures\\2009 Original Church Pictures\\{ Mergefield
?? "Full_Name"}.JPG" }. I would like to insert a standard
?? NoPictureAvailable.jpg file if there is no picture for the family in
?? question. Is there a way to do this?
??
?? Thanks,
??
?? Colonel Blip
?? E-mail: colonel.blip.at.bigfoot.com
??

With best regards, colblip. E-mail: colonel.blip.at.bigfoot.com




  #6   Report Post  
Posted to microsoft.public.word.mailmerge.fields,microsoft.public.word.newusers
colblip colblip is offline
external usenet poster
 
Posts: 19
Default Merging pictures

Hello, Doug!

I mis-understood - thought you were pointing out you only used one \ for
ease of typing and I should use \\. I have corrected that and now when I
Alt-F9 I get a message in the code area "Error! File Name not specified".
I've checked the code more times than I care to admit. I've double checked I
have a picture "NoPictureAvailable.jpg" so I don't know what might be the
problem.

BTW, it has been too long since I worked in field codes. I recall there was
some way to copy or print out these lines of code so one could paste them as
text. What is it?

Sorry for all of my trouble. Thanks again for the help.

You wrote on Fri, 7 Aug 2009 06:39:43 +1000:

DRW Note that only a single \ is used as the path separator in the above.

DRW You still have \\ as the path separator.

DRW --
DRW Hope this helps.

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

DRW Doug Robbins - Word MVP, originally posted via msnews.microsoft.com
DRW "colblip" colonel.blip.at.bigfoot.com wrote in message
DRW ...
?? Hello, Doug!
??
?? Doug,
??
?? Tried the code as follows per your suggestion but result was no
?? pictures in merged file. Here is my code to be sure I didn't miss
something:
??
?? { IF { INCLUDEPICTURE {IF TRUE "O:\\Pictures\\2009 Original Church
?? Pictures\\{ Mergefield "Full_Name"}.JPG"} } { INCLUDEPICTURE {IF TRUE
?? "O:\\Pictures\\2009
?? Original Church Pictures\\{ Mergefield "Full_Name"}.JPG"} } {
?? INCLUDEPICTURE { IF TRUE "O:\\Pictures\\2009 Original Church
??
?? Pictures\\NoPictureAvailable.jpg" } } }
??
?? Anything obviously messed up that I've missed?
??
?? You wrote on Thu, 6 Aug 2009 11:29:35 +1000:
??
DRW {IF {INCLUDEPICTURE {IF TRUE "O:\Pictures\2009 Original Church
DRW Pictures\{ Mergefield "Full_Name"}.JPG"}} {INCLUDEPICTURE {IF TRUE
DRW "O:\Pictures\2009 Original Church Pictures\{ Mergefield
DRW "Full_Name"}.JPG"}} {INCLUDEPICTURE {IF TRUE "O:\Pictures\2009
DRW Original Church Pictures\NoPictureAvailable.jpg"}} }
??
DRW Note that only a single \ is used as the path separator in the above
DRW construction.
DRW --
DRW Hope this helps.
??
DRW Please reply to the newsgroup unless you wish to avail yourself of
DRW my services on a paid consulting basis.
??
DRW Doug Robbins - Word MVP, originally posted via msnews.microsoft.com
DRW "colblip" colonel.blip.at.bigfoot.com wrote in message
DRW ...
?? Hello, All!
?? I have a directory I print for the church. In it I have insert a
?? picture of the family with the code {INCLUDEPICTURE
?? "O:\\Pictures\\2009 Original Church Pictures\\{ Mergefield
?? "Full_Name"}.JPG" }. I would like to insert a standard
?? NoPictureAvailable.jpg file if there is no picture for the family in
?? question. Is there a way to do this?
??
?? Thanks,
??
?? Colonel Blip
?? E-mail: colonel.blip.at.bigfoot.com
??
?? With best regards, colblip. E-mail: colonel.blip.at.bigfoot.com
??

With best regards, colblip. E-mail: colonel.blip.at.bigfoot.com


  #7   Report Post  
Posted to microsoft.public.word.mailmerge.fields,microsoft.public.word.newusers
Doug Robbins - Word MVP Doug Robbins - Word MVP is offline
external usenet poster
 
Posts: 8,832
Default Merging pictures

This will also be applicable to your response to Macropod in the other
thread that you have started. It is better not to do that.

What do you have in the data source for the records where there is no "full
name".jpg? If you have NoPictureAvailable.jpg then, the following
information previously posted by macropod should get you going:

When embedding a mailmerge field in an INCLUDEPICTURE field for the purpose
of merging graphics:
1. the filepaths to the fields ordinarily need to have the separators
expressed as '\\' or '/' instead of the usual '\';
2. the pictures usually won't show until you refresh the fields (eg Ctrl-A,
then F9); and
3. even after updating the images, they remain linked to the image files,
which can be an issue if you need to send the merged
output to someone else.

The following field construction addresses all three issues:
{IF {INCLUDEPICTURE {IF TRUE "C:\Users\My Document Path\Pictures\«Image»"}}
{INCLUDEPICTURE {IF TRUE "C:\Users\My Document
Path\Pictures\«Image»"}}}
or
{IF {INCLUDEPICTURE {IF TRUE "C:\Users\My Document Path\Pictures\{MERGEFIELD
Image}"}} {INCLUDEPICTURE {IF TRUE "C:\Users\My
Document Path\Pictures\{MERGEFIELD Image}"}}}

After running a mailmerge coded this way, you'll have the correct, unlinked
image for each record.
If your path separators are already expressed as '\\' or '/', that will work
too.

If the path data are included with in the image field, you can use:
{IF {INCLUDEPICTURE {IF TRUE "«Image»"}} {INCLUDEPICTURE {IF TRUE
"«Image»"}}}
or
{IF {INCLUDEPICTURE {IF TRUE "{MERGEFIELD Image}"}} {INCLUDEPICTURE {IF TRUE
"{MERGEFIELD Image}"}}}

Note: The field brace pairs (ie '{ }') for the above examples are created
via Ctrl-F9 - you can't simply type them or copy & paste
them from this message. Likwise, you can't type the chevrons (ie '« »') -
they're part of the actual mergefields, which you can
insert from the mailmerge toolbar.



--
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, originally posted via msnews.microsoft.com
"colblip" colonel.blip.at.bigfoot.com wrote in message
...
Hello, Doug!

I mis-understood - thought you were pointing out you only used one \ for
ease of typing and I should use \\. I have corrected that and now when I
Alt-F9 I get a message in the code area "Error! File Name not specified".
I've checked the code more times than I care to admit. I've double checked
I have a picture "NoPictureAvailable.jpg" so I don't know what might be
the problem.

BTW, it has been too long since I worked in field codes. I recall there
was some way to copy or print out these lines of code so one could paste
them as text. What is it?

Sorry for all of my trouble. Thanks again for the help.

You wrote on Fri, 7 Aug 2009 06:39:43 +1000:

DRW Note that only a single \ is used as the path separator in the above.

DRW You still have \\ as the path separator.

DRW --
DRW Hope this helps.

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

DRW Doug Robbins - Word MVP, originally posted via msnews.microsoft.com
DRW "colblip" colonel.blip.at.bigfoot.com wrote in message
DRW ...
?? Hello, Doug!
??
?? Doug,
??
?? Tried the code as follows per your suggestion but result was no
?? pictures in merged file. Here is my code to be sure I didn't miss
something:
??
?? { IF { INCLUDEPICTURE {IF TRUE "O:\\Pictures\\2009 Original Church
?? Pictures\\{ Mergefield "Full_Name"}.JPG"} } { INCLUDEPICTURE {IF TRUE
?? "O:\\Pictures\\2009
?? Original Church Pictures\\{ Mergefield "Full_Name"}.JPG"} } {
?? INCLUDEPICTURE { IF TRUE "O:\\Pictures\\2009 Original Church
??
?? Pictures\\NoPictureAvailable.jpg" } } }
??
?? Anything obviously messed up that I've missed?
??
?? You wrote on Thu, 6 Aug 2009 11:29:35 +1000:
??
DRW {IF {INCLUDEPICTURE {IF TRUE "O:\Pictures\2009 Original Church
DRW Pictures\{ Mergefield "Full_Name"}.JPG"}} {INCLUDEPICTURE {IF TRUE
DRW "O:\Pictures\2009 Original Church Pictures\{ Mergefield
DRW "Full_Name"}.JPG"}} {INCLUDEPICTURE {IF TRUE "O:\Pictures\2009
DRW Original Church Pictures\NoPictureAvailable.jpg"}} }
??
DRW Note that only a single \ is used as the path separator in the
above
DRW construction.
DRW --
DRW Hope this helps.
??
DRW Please reply to the newsgroup unless you wish to avail yourself of
DRW my services on a paid consulting basis.
??
DRW Doug Robbins - Word MVP, originally posted via msnews.microsoft.com
DRW "colblip" colonel.blip.at.bigfoot.com wrote in message
DRW ...
?? Hello, All!
?? I have a directory I print for the church. In it I have insert a
?? picture of the family with the code {INCLUDEPICTURE
?? "O:\\Pictures\\2009 Original Church Pictures\\{ Mergefield
?? "Full_Name"}.JPG" }. I would like to insert a standard
?? NoPictureAvailable.jpg file if there is no picture for the family
in
?? question. Is there a way to do this?
??
?? Thanks,
??
?? Colonel Blip
?? E-mail: colonel.blip.at.bigfoot.com
??
?? With best regards, colblip. E-mail: colonel.blip.at.bigfoot.com
??

With best regards, colblip. E-mail: colonel.blip.at.bigfoot.com


  #8   Report Post  
Posted to microsoft.public.word.mailmerge.fields
colblip colblip is offline
external usenet poster
 
Posts: 19
Default Merging pictures

Doug, macropod,

I need to drop back the better part of the field and start over. I'm getting
a bit overwhelmed. Further, I'll keep it in one group and continue one
thread rather than two.

Currently I run a mail merge out of Outlook with names, addresses etc. Let's
say this produces 5 records,

Joe & Mary
Harry & Sue
John & Jill
Sam & Linda
Gary and Gertrude

I have 3 photos for these five families

Joe & Mary.jpg
John & Jill.jpg
Gary and Gertrude.jpg
and I have a picture - NoPictureAvailable.jpg.

As my mail merge document now exists I produce a page with each record
having a photo of the family with their name, address, etc listed under the
photo. All of the photos are in a folder - O:\Pictures\2009 Original Church
Pictures.

My photo area of the merge has the code: {INCLUDEPICTURE "O:\\Pictures\\2009
Original Church Pictures\\{ Mergefield "Full_Name"}.JPG" } in it.

I run the merge, I do a cntl-A and F9 and all of the pictures load
appropriately. The problem is - for the "Harry & Sue" and "Sam & Linda"
merged records there is no corresponding photos. My desire is to load a
dummy picture, NoPhotoAvailable, for these two records. The BF&A approach
would be to copy/rename the NoPhotoAvailable.jpg to "Harry & Sue.jpg" and
"Sam & Linda.jpg" and everything would work fine. However, I was hoping to
make the code such that loading "NoPhotoAvailable.jpg" could be made to
occur if there was no family picture in my picture folder.

Just for completeness I do know I have to use cntrl-F9 for the braces and
I've constructed all of the code using Insert|Field... for any of the
operators.

I do wish there was a simple way to print out my code in text so it could be
copied and pasted in documents like this a text rather than having to type
it all in. :-(

I hope this helps better explain what I am trying to do. Thanks for your
help AND patience on all of this.

"colblip" colonel.blip.at.bigfoot.com wrote in message
...
Hello, All!
I have a directory I print for the church. In it I have insert a picture
of the family with the code {INCLUDEPICTURE "O:\\Pictures\\2009 Original
Church Pictures\\{ Mergefield "Full_Name"}.JPG" }. I would like to insert
a standard NoPictureAvailable.jpg file if there is no picture for the
family in question. Is there a way to do this?

Thanks,

Colonel Blip
E-mail: colonel.blip.at.bigfoot.com



  #9   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Doug Robbins - Word MVP Doug Robbins - Word MVP is offline
external usenet poster
 
Posts: 8,832
Default Merging pictures

I am not sure that can be done using just a field construction. I say that
however in the realization that fellow MVP Macropod will (as he usually
does) come along and prove me wrong.

However if you use your Outlook data source to perform a Directory type mail
merge in the main document of which you insert the mergefields into the
cells of a one row table with the mergefield in the first cell being that
which contains the names, and you execute that merge to a new document, you
will then get a table with a row of data for each record in the data source
with the first column containing

Joe & Mary
Harry & Sue
John & Jill
Sam & Linda
Gary and Gertrude

Now, if you insert a new column to the right of that column and then with
that document as the active document, you run a macro containing the
following code:

Dim Family As Range
Dim i As Long
Dim MyPath As String
Dim Picture As String
Dim picfile As String
Dim Flag As Boolean
With ActiveDocument.Tables(1)
For i = 1 To .Rows.Count
Flag = False
Set Family = .Cell(i, 1).Range
Family.End = Family.End - 1
picfile = Family.Text & ".jpg"
Picture = Dir$("O:\Pictures\2009 Original Church Pictures\*.jpg")
Do While Picture ""
MsgBox Picture
If UCase(Picture) = UCase(picfile) Then
.Cell(i, 2).Range.Text = picfile
Flag = True
Exit Do
End If
Picture = Dir
Loop
If Flag = False Then
.Cell(i, 2).Range.Text = "NoPhotoAvailable.jpg"
End If
Next i
End With

it will populate the cells in the second column with the picture filename of
the couple if it exists or with NoPictureAvailable.jpg if it does not so
that the first two cells of the table will then contain

Joe & Mary Joe & Mary.jpg
Harry & Sue NoPictureAvailable.jpg
John & Jill John & Jill.jpg
Sam & Linda NoPictureAvailable.jpg
Gary and Gertrude Gary & Gertrude.jpg

Now you can insert a row at the top of the table into the cells of which you
insert the names of the mergefields (not the mergefields themselves) and
save this document and use it as the data source for the merge that you
originally wanted to create.

--
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, originally posted via msnews.microsoft.com
"colblip" colonel.blip.at.bigfoot.com wrote in message
...
Doug, macropod,

I need to drop back the better part of the field and start over. I'm
getting a bit overwhelmed. Further, I'll keep it in one group and continue
one thread rather than two.

Currently I run a mail merge out of Outlook with names, addresses etc.
Let's say this produces 5 records,

Joe & Mary
Harry & Sue
John & Jill
Sam & Linda
Gary and Gertrude

I have 3 photos for these five families

Joe & Mary.jpg
John & Jill.jpg
Gary and Gertrude.jpg
and I have a picture - NoPictureAvailable.jpg.

As my mail merge document now exists I produce a page with each record
having a photo of the family with their name, address, etc listed under
the photo. All of the photos are in a folder - O:\Pictures\2009 Original
Church Pictures.

My photo area of the merge has the code: {INCLUDEPICTURE
"O:\\Pictures\\2009 Original Church Pictures\\{ Mergefield
"Full_Name"}.JPG" } in it.

I run the merge, I do a cntl-A and F9 and all of the pictures load
appropriately. The problem is - for the "Harry & Sue" and "Sam & Linda"
merged records there is no corresponding photos. My desire is to load a
dummy picture, NoPhotoAvailable, for these two records. The BF&A approach
would be to copy/rename the NoPhotoAvailable.jpg to "Harry & Sue.jpg" and
"Sam & Linda.jpg" and everything would work fine. However, I was hoping to
make the code such that loading "NoPhotoAvailable.jpg" could be made to
occur if there was no family picture in my picture folder.

Just for completeness I do know I have to use cntrl-F9 for the braces and
I've constructed all of the code using Insert|Field... for any of the
operators.

I do wish there was a simple way to print out my code in text so it could
be copied and pasted in documents like this a text rather than having to
type it all in. :-(

I hope this helps better explain what I am trying to do. Thanks for your
help AND patience on all of this.

"colblip" colonel.blip.at.bigfoot.com wrote in message
...
Hello, All!
I have a directory I print for the church. In it I have insert a picture
of the family with the code {INCLUDEPICTURE "O:\\Pictures\\2009 Original
Church Pictures\\{ Mergefield "Full_Name"}.JPG" }. I would like to insert
a standard NoPictureAvailable.jpg file if there is no picture for the
family in question. Is there a way to do this?

Thanks,

Colonel Blip
E-mail: colonel.blip.at.bigfoot.com




  #10   Report Post  
Posted to microsoft.public.word.mailmerge.fields,microsoft.public.word.newusers
macropod[_2_] macropod[_2_] is offline
external usenet poster
 
Posts: 2,059
Default Merging pictures

Hi colblip,

There's some macro code for converting between field codes and the textual representations of them at:
http://www.wopr.com/index.php?showto...#entry320 421

--
Cheers
macropod
[Microsoft MVP - Word]


"colblip" colonel.blip.at.bigfoot.com wrote in message ...
Hello, Doug!

I mis-understood - thought you were pointing out you only used one \ for
ease of typing and I should use \\. I have corrected that and now when I
Alt-F9 I get a message in the code area "Error! File Name not specified".
I've checked the code more times than I care to admit. I've double checked I
have a picture "NoPictureAvailable.jpg" so I don't know what might be the
problem.

BTW, it has been too long since I worked in field codes. I recall there was
some way to copy or print out these lines of code so one could paste them as
text. What is it?

Sorry for all of my trouble. Thanks again for the help.

You wrote on Fri, 7 Aug 2009 06:39:43 +1000:

DRW Note that only a single \ is used as the path separator in the above.

DRW You still have \\ as the path separator.

DRW --
DRW Hope this helps.

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

DRW Doug Robbins - Word MVP, originally posted via msnews.microsoft.com
DRW "colblip" colonel.blip.at.bigfoot.com wrote in message
DRW ...
?? Hello, Doug!
??
?? Doug,
??
?? Tried the code as follows per your suggestion but result was no
?? pictures in merged file. Here is my code to be sure I didn't miss
something:
??
?? { IF { INCLUDEPICTURE {IF TRUE "O:\\Pictures\\2009 Original Church
?? Pictures\\{ Mergefield "Full_Name"}.JPG"} } { INCLUDEPICTURE {IF TRUE
?? "O:\\Pictures\\2009
?? Original Church Pictures\\{ Mergefield "Full_Name"}.JPG"} } {
?? INCLUDEPICTURE { IF TRUE "O:\\Pictures\\2009 Original Church
??
?? Pictures\\NoPictureAvailable.jpg" } } }
??
?? Anything obviously messed up that I've missed?
??
?? You wrote on Thu, 6 Aug 2009 11:29:35 +1000:
??
DRW {IF {INCLUDEPICTURE {IF TRUE "O:\Pictures\2009 Original Church
DRW Pictures\{ Mergefield "Full_Name"}.JPG"}} {INCLUDEPICTURE {IF TRUE
DRW "O:\Pictures\2009 Original Church Pictures\{ Mergefield
DRW "Full_Name"}.JPG"}} {INCLUDEPICTURE {IF TRUE "O:\Pictures\2009
DRW Original Church Pictures\NoPictureAvailable.jpg"}} }
??
DRW Note that only a single \ is used as the path separator in the above
DRW construction.
DRW --
DRW Hope this helps.
??
DRW Please reply to the newsgroup unless you wish to avail yourself of
DRW my services on a paid consulting basis.
??
DRW Doug Robbins - Word MVP, originally posted via msnews.microsoft.com
DRW "colblip" colonel.blip.at.bigfoot.com wrote in message
DRW ...
?? Hello, All!
?? I have a directory I print for the church. In it I have insert a
?? picture of the family with the code {INCLUDEPICTURE
?? "O:\\Pictures\\2009 Original Church Pictures\\{ Mergefield
?? "Full_Name"}.JPG" }. I would like to insert a standard
?? NoPictureAvailable.jpg file if there is no picture for the family in
?? question. Is there a way to do this?
??
?? Thanks,
??
?? Colonel Blip
?? E-mail: colonel.blip.at.bigfoot.com
??
?? With best regards, colblip. E-mail: colonel.blip.at.bigfoot.com
??

With best regards, colblip. E-mail: colonel.blip.at.bigfoot.com




  #11   Report Post  
Posted to microsoft.public.word.mailmerge.fields
macropod[_2_] macropod[_2_] is offline
external usenet poster
 
Posts: 2,059
Default Merging pictures

Hi Doug,

The field coding I've provided in microsoft.public.word.newusers does exactly that! The field code the OP is using is:
{INCLUDEPICTURE "O:\\Pictures\\2009 Original Church Pictures\\{IF{MERGEFIELD "Full_Name"}= "" "NoPicture" {MERGEFIELD
"Full_Name"}}.JPG"}

The OP's problem is that, where there's no picture for the record, the image from the previous record is being inserted. I believe
this is caused by the combination of a bug in Word 2007 and either:
1. the 'NoPicture.jpg' file doesn't exist in the image folder; or
2. the supposedly 'empty' picture name record isn't really empty

--
Cheers
macropod
[Microsoft MVP - Word]


"Doug Robbins - Word MVP" wrote in message ...
I am not sure that can be done using just a field construction. I say that however in the realization that fellow MVP Macropod
will (as he usually does) come along and prove me wrong.

However if you use your Outlook data source to perform a Directory type mail merge in the main document of which you insert the
mergefields into the cells of a one row table with the mergefield in the first cell being that which contains the names, and you
execute that merge to a new document, you will then get a table with a row of data for each record in the data source with the
first column containing

Joe & Mary
Harry & Sue
John & Jill
Sam & Linda
Gary and Gertrude

Now, if you insert a new column to the right of that column and then with that document as the active document, you run a macro
containing the following code:

Dim Family As Range
Dim i As Long
Dim MyPath As String
Dim Picture As String
Dim picfile As String
Dim Flag As Boolean
With ActiveDocument.Tables(1)
For i = 1 To .Rows.Count
Flag = False
Set Family = .Cell(i, 1).Range
Family.End = Family.End - 1
picfile = Family.Text & ".jpg"
Picture = Dir$("O:\Pictures\2009 Original Church Pictures\*.jpg")
Do While Picture ""
MsgBox Picture
If UCase(Picture) = UCase(picfile) Then
.Cell(i, 2).Range.Text = picfile
Flag = True
Exit Do
End If
Picture = Dir
Loop
If Flag = False Then
.Cell(i, 2).Range.Text = "NoPhotoAvailable.jpg"
End If
Next i
End With

it will populate the cells in the second column with the picture filename of the couple if it exists or with
NoPictureAvailable.jpg if it does not so that the first two cells of the table will then contain

Joe & Mary Joe & Mary.jpg
Harry & Sue NoPictureAvailable.jpg
John & Jill John & Jill.jpg
Sam & Linda NoPictureAvailable.jpg
Gary and Gertrude Gary & Gertrude.jpg

Now you can insert a row at the top of the table into the cells of which you insert the names of the mergefields (not the
mergefields themselves) and save this document and use it as the data source for the merge that you originally wanted to create.

--
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, originally posted via msnews.microsoft.com
"colblip" colonel.blip.at.bigfoot.com wrote in message ...
Doug, macropod,

I need to drop back the better part of the field and start over. I'm getting a bit overwhelmed. Further, I'll keep it in one
group and continue one thread rather than two.

Currently I run a mail merge out of Outlook with names, addresses etc. Let's say this produces 5 records,

Joe & Mary
Harry & Sue
John & Jill
Sam & Linda
Gary and Gertrude

I have 3 photos for these five families

Joe & Mary.jpg
John & Jill.jpg
Gary and Gertrude.jpg
and I have a picture - NoPictureAvailable.jpg.

As my mail merge document now exists I produce a page with each record having a photo of the family with their name, address, etc
listed under the photo. All of the photos are in a folder - O:\Pictures\2009 Original Church Pictures.

My photo area of the merge has the code: {INCLUDEPICTURE "O:\\Pictures\\2009 Original Church Pictures\\{ Mergefield
"Full_Name"}.JPG" } in it.

I run the merge, I do a cntl-A and F9 and all of the pictures load appropriately. The problem is - for the "Harry & Sue" and "Sam
& Linda" merged records there is no corresponding photos. My desire is to load a dummy picture, NoPhotoAvailable, for these two
records. The BF&A approach would be to copy/rename the NoPhotoAvailable.jpg to "Harry & Sue.jpg" and "Sam & Linda.jpg" and
everything would work fine. However, I was hoping to make the code such that loading "NoPhotoAvailable.jpg" could be made to
occur if there was no family picture in my picture folder.

Just for completeness I do know I have to use cntrl-F9 for the braces and I've constructed all of the code using Insert|Field...
for any of the operators.

I do wish there was a simple way to print out my code in text so it could be copied and pasted in documents like this a text
rather than having to type it all in. :-(

I hope this helps better explain what I am trying to do. Thanks for your help AND patience on all of this.

"colblip" colonel.blip.at.bigfoot.com wrote in message ...
Hello, All!
I have a directory I print for the church. In it I have insert a picture of the family with the code {INCLUDEPICTURE
"O:\\Pictures\\2009 Original Church Pictures\\{ Mergefield "Full_Name"}.JPG" }. I would like to insert a standard
NoPictureAvailable.jpg file if there is no picture for the family in question. Is there a way to do this?

Thanks,

Colonel Blip
E-mail: colonel.blip.at.bigfoot.com





  #12   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Graham Mayor Graham Mayor is offline
external usenet poster
 
Posts: 19,312
Default Merging pictures

My understanding was that Mergefield Full_Name would always be true for
every record so 'No Picture' would never be used.
The only way to do this I feel is to introduce another field or to introduce
blank images for each of the missing pictures named to match the full_name..

--

Graham Mayor - Word MVP

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



macropod wrote:
Hi Doug,

The field coding I've provided in microsoft.public.word.newusers does
exactly that! The field code the OP is using is: {INCLUDEPICTURE
"O:\\Pictures\\2009 Original Church Pictures\\{IF{MERGEFIELD "Full_Name"}=
"" "NoPicture" {MERGEFIELD "Full_Name"}}.JPG"}
The OP's problem is that, where there's no picture for the record,
the image from the previous record is being inserted. I believe this
is caused by the combination of a bug in Word 2007 and either: 1. the
'NoPicture.jpg' file doesn't exist in the image folder; or
2. the supposedly 'empty' picture name record isn't really empty


"Doug Robbins - Word MVP" wrote in message
...
I am not sure that can be done using just a field construction. I
say that however in the realization that fellow MVP Macropod will
(as he usually does) come along and prove me wrong. However if you use
your Outlook data source to perform a Directory
type mail merge in the main document of which you insert the
mergefields into the cells of a one row table with the mergefield in
the first cell being that which contains the names, and you execute
that merge to a new document, you will then get a table with a row
of data for each record in the data source with the first column
containing Joe & Mary
Harry & Sue
John & Jill
Sam & Linda
Gary and Gertrude

Now, if you insert a new column to the right of that column and then
with that document as the active document, you run a macro
containing the following code: Dim Family As Range
Dim i As Long
Dim MyPath As String
Dim Picture As String
Dim picfile As String
Dim Flag As Boolean
With ActiveDocument.Tables(1)
For i = 1 To .Rows.Count
Flag = False
Set Family = .Cell(i, 1).Range
Family.End = Family.End - 1
picfile = Family.Text & ".jpg"
Picture = Dir$("O:\Pictures\2009 Original Church Pictures\*.jpg")
Do While Picture ""
MsgBox Picture
If UCase(Picture) = UCase(picfile) Then
.Cell(i, 2).Range.Text = picfile
Flag = True
Exit Do
End If
Picture = Dir
Loop
If Flag = False Then
.Cell(i, 2).Range.Text = "NoPhotoAvailable.jpg"
End If
Next i
End With

it will populate the cells in the second column with the picture
filename of the couple if it exists or with NoPictureAvailable.jpg
if it does not so that the first two cells of the table will then
contain Joe & Mary Joe & Mary.jpg
Harry & Sue NoPictureAvailable.jpg
John & Jill John & Jill.jpg
Sam & Linda NoPictureAvailable.jpg
Gary and Gertrude Gary & Gertrude.jpg

Now you can insert a row at the top of the table into the cells of
which you insert the names of the mergefields (not the mergefields
themselves) and save this document and use it as the data source for
the merge that you originally wanted to create. --
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, originally posted via msnews.microsoft.com
"colblip" colonel.blip.at.bigfoot.com wrote in message
...
Doug, macropod,

I need to drop back the better part of the field and start over.
I'm getting a bit overwhelmed. Further, I'll keep it in one group
and continue one thread rather than two. Currently I run a mail merge
out of Outlook with names, addresses
etc. Let's say this produces 5 records, Joe & Mary
Harry & Sue
John & Jill
Sam & Linda
Gary and Gertrude

I have 3 photos for these five families

Joe & Mary.jpg
John & Jill.jpg
Gary and Gertrude.jpg
and I have a picture - NoPictureAvailable.jpg.

As my mail merge document now exists I produce a page with each
record having a photo of the family with their name, address, etc
listed under the photo. All of the photos are in a folder -
O:\Pictures\2009 Original Church Pictures. My photo area of the merge
has the code: {INCLUDEPICTURE
"O:\\Pictures\\2009 Original Church Pictures\\{ Mergefield
"Full_Name"}.JPG" } in it. I run the merge, I do a cntl-A and F9 and all
of the pictures load
appropriately. The problem is - for the "Harry & Sue" and "Sam &
Linda" merged records there is no corresponding photos. My desire
is to load a dummy picture, NoPhotoAvailable, for these two
records. The BF&A approach would be to copy/rename the
NoPhotoAvailable.jpg to "Harry & Sue.jpg" and "Sam & Linda.jpg" and
everything would work fine. However, I was hoping to make the code
such that loading "NoPhotoAvailable.jpg" could be made to occur if
there was no family picture in my picture folder. Just for
completeness I do know I have to use cntrl-F9 for the
braces and I've constructed all of the code using Insert|Field...
for any of the operators. I do wish there was a simple way to print out
my code in text so it
could be copied and pasted in documents like this a text rather
than having to type it all in. :-( I hope this helps better explain what
I am trying to do. Thanks for
your help AND patience on all of this. "colblip"
colonel.blip.at.bigfoot.com wrote in message
...
Hello, All!
I have a directory I print for the church. In it I have insert a
picture of the family with the code {INCLUDEPICTURE
"O:\\Pictures\\2009 Original Church Pictures\\{ Mergefield
"Full_Name"}.JPG" }. I would like to insert a standard
NoPictureAvailable.jpg file if there is no picture for the family
in question. Is there a way to do this? Thanks,

Colonel Blip
E-mail: colonel.blip.at.bigfoot.com



  #13   Report Post  
Posted to microsoft.public.word.mailmerge.fields
colblip colblip is offline
external usenet poster
 
Posts: 19
Default Merging pictures

Same understanding here now (after all of you MVP folks have been working
with me). I noted in my latest message I took a different approach, tho
coding may be wrong, of checking for the picture file. Didn't work for
whatever reason.

Hello, Graham!
You wrote on Sat, 8 Aug 2009 17:41:05 +0300:

GM My understanding was that Mergefield Full_Name would always be true for
GM every record so 'No Picture' would never be used.
GM The only way to do this I feel is to introduce another field or to
GM introduce blank images for each of the missing pictures named to match
GM the full_name..

GM --
GM
GM Graham Mayor - Word MVP

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

GM macropod wrote:
?? Hi Doug,
??
?? The field coding I've provided in microsoft.public.word.newusers does
?? exactly that! The field code the OP is using is: {INCLUDEPICTURE
?? "O:\\Pictures\\2009 Original Church Pictures\\{IF{MERGEFIELD
?? "Full_Name"}= "" "NoPicture" {MERGEFIELD "Full_Name"}}.JPG"} The OP's
?? problem is that, where there's no picture for the record, the image
?? from the previous record is being inserted. I believe this is caused
?? by the combination of a bug in Word 2007 and either: 1. the
'NoPicture.jpg'
?? file doesn't exist in the image folder; or 2. the supposedly 'empty'
?? picture name record isn't really empty
??
?? "Doug Robbins - Word MVP" wrote in message
?? ...
?? I am not sure that can be done using just a field construction. I
?? say that however in the realization that fellow MVP Macropod will
?? (as he usually does) come along and prove me wrong. However if you
?? use your Outlook data source to perform a Directory type mail merge
?? in the main document of which you insert the mergefields into the
?? cells of a one row table with the mergefield in the first cell being
?? that which contains the names, and you execute that merge to a new
?? document, you will then get a table with a row of data for each
?? record in the data source with the first column containing Joe &
?? Mary Harry & Sue John & Jill Sam & Linda Gary and Gertrude
??
?? Now, if you insert a new column to the right of that column and then
?? with that document as the active document, you run a macro
?? containing the following code: Dim Family As Range
?? Dim i As Long
?? Dim MyPath As String
?? Dim Picture As String
?? Dim picfile As String
?? Dim Flag As Boolean
?? With ActiveDocument.Tables(1)
?? For i = 1 To .Rows.Count
?? Flag = False
?? Set Family = .Cell(i, 1).Range
?? Family.End = Family.End - 1
?? picfile = Family.Text & ".jpg"
?? Picture = Dir$("O:\Pictures\2009 Original Church
?? Pictures\*.jpg") Do While Picture "" MsgBox Picture
?? If UCase(Picture) = UCase(picfile) Then .Cell(i,
?? 2).Range.Text = picfile Flag = True Exit
?? Do End If Picture = Dir Loop If Flag
?? = False Then .Cell(i, 2).Range.Text =
?? "NoPhotoAvailable.jpg" End If Next i End With
??
?? it will populate the cells in the second column with the picture
?? filename of the couple if it exists or with NoPictureAvailable.jpg
?? if it does not so that the first two cells of the table will then
?? contain Joe & Mary Joe & Mary.jpg
?? Harry & Sue NoPictureAvailable.jpg
?? John & Jill John & Jill.jpg
?? Sam & Linda NoPictureAvailable.jpg
?? Gary and Gertrude Gary & Gertrude.jpg
??
?? Now you can insert a row at the top of the table into the cells of
?? which you insert the names of the mergefields (not the mergefields
?? themselves) and save this document and use it as the data source for
?? the merge that you originally wanted to create. --
?? 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, originally posted via msnews.microsoft.com
?? "colblip" colonel.blip.at.bigfoot.com wrote in message
?? ...
?? Doug, macropod,
??
?? I need to drop back the better part of the field and start over.
?? I'm getting a bit overwhelmed. Further, I'll keep it in one group
?? and continue one thread rather than two. Currently I run a mail
?? merge out of Outlook with names, addresses etc. Let's say this
?? produces 5 records, Joe & Mary Harry & Sue John & Jill Sam &
?? Linda Gary and Gertrude
??
?? I have 3 photos for these five families
??
?? Joe & Mary.jpg
?? John & Jill.jpg
?? Gary and Gertrude.jpg
?? and I have a picture - NoPictureAvailable.jpg.
??
?? As my mail merge document now exists I produce a page with each
?? record having a photo of the family with their name, address, etc
?? listed under the photo. All of the photos are in a folder -
?? O:\Pictures\2009 Original Church Pictures. My photo area of the
?? merge has the code: {INCLUDEPICTURE "O:\\Pictures\\2009 Original
Church
?? Pictures\\{ Mergefield "Full_Name"}.JPG" } in it. I run the merge, I
?? do a cntl-A and F9 and all of the pictures load appropriately. The
?? problem is - for the "Harry & Sue" and "Sam & Linda" merged records
?? there is no corresponding photos. My desire is to load a dummy
?? picture, NoPhotoAvailable, for these two records. The BF&A approach
?? would be to copy/rename the NoPhotoAvailable.jpg to "Harry &
?? Sue.jpg" and "Sam & Linda.jpg" and everything would work fine.
?? However, I was hoping to make the code such that loading
?? "NoPhotoAvailable.jpg" could be made to occur if there was no family
?? picture in my picture folder. Just for completeness I do know I
?? have to use cntrl-F9 for the braces and I've constructed all of the
?? code using Insert|Field... for any of the operators. I do wish there
?? was a simple way to print out my code in text so it could be copied
?? and pasted in documents like this a text rather than having to type
?? it all in. :-( I hope this helps better explain what I am trying to
?? do. Thanks for your help AND patience on all of this. "colblip"
?? colonel.blip.at.bigfoot.com wrote in
?? message ...
?? Hello, All!
?? I have a directory I print for the church. In it I have insert a
?? picture of the family with the code {INCLUDEPICTURE
?? "O:\\Pictures\\2009 Original Church Pictures\\{ Mergefield
?? "Full_Name"}.JPG" }. I would like to insert a standard
?? NoPictureAvailable.jpg file if there is no picture for the family
?? in question. Is there a way to do this? Thanks,
??
?? Colonel Blip
?? E-mail: colonel.blip.at.bigfoot.com


With best regards, colblip. E-mail: colonel.blip.at.bigfoot.com


  #14   Report Post  
Posted to microsoft.public.word.mailmerge.fields
macropod[_2_] macropod[_2_] is offline
external usenet poster
 
Posts: 2,059
Default Merging pictures

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}"}}}

--
Cheers
macropod
[Microsoft MVP - Word]


"colblip" colonel.blip.at.bigfoot.com wrote in message ...
Doug, macropod,

I need to drop back the better part of the field and start over. I'm getting a bit overwhelmed. Further, I'll keep it in one group
and continue one thread rather than two.

Currently I run a mail merge out of Outlook with names, addresses etc. Let's say this produces 5 records,

Joe & Mary
Harry & Sue
John & Jill
Sam & Linda
Gary and Gertrude

I have 3 photos for these five families

Joe & Mary.jpg
John & Jill.jpg
Gary and Gertrude.jpg
and I have a picture - NoPictureAvailable.jpg.

As my mail merge document now exists I produce a page with each record having a photo of the family with their name, address, etc
listed under the photo. All of the photos are in a folder - O:\Pictures\2009 Original Church Pictures.

My photo area of the merge has the code: {INCLUDEPICTURE "O:\\Pictures\\2009 Original Church Pictures\\{ Mergefield
"Full_Name"}.JPG" } in it.

I run the merge, I do a cntl-A and F9 and all of the pictures load appropriately. The problem is - for the "Harry & Sue" and "Sam
& Linda" merged records there is no corresponding photos. My desire is to load a dummy picture, NoPhotoAvailable, for these two
records. The BF&A approach would be to copy/rename the NoPhotoAvailable.jpg to "Harry & Sue.jpg" and "Sam & Linda.jpg" and
everything would work fine. However, I was hoping to make the code such that loading "NoPhotoAvailable.jpg" could be made to occur
if there was no family picture in my picture folder.

Just for completeness I do know I have to use cntrl-F9 for the braces and I've constructed all of the code using Insert|Field...
for any of the operators.

I do wish there was a simple way to print out my code in text so it could be copied and pasted in documents like this a text
rather than having to type it all in. :-(

I hope this helps better explain what I am trying to do. Thanks for your help AND patience on all of this.

"colblip" colonel.blip.at.bigfoot.com wrote in message ...
Hello, All!
I have a directory I print for the church. In it I have insert a picture of the family with the code {INCLUDEPICTURE
"O:\\Pictures\\2009 Original Church Pictures\\{ Mergefield "Full_Name"}.JPG" }. I would like to insert a standard
NoPictureAvailable.jpg file if there is no picture for the family in question. Is there a way to do this?

Thanks,

Colonel Blip
E-mail: colonel.blip.at.bigfoot.com




  #15   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Doug Robbins - Word MVP Doug Robbins - Word MVP is offline
external usenet poster
 
Posts: 8,832
Default Merging pictures

It's either manual brute force creating individual "faceless" picture files
named to match the Full_Name for those records for which there is no picture
or the automated brute force using the method I have given you, which only
requires the one "faceless" picture file.

I know which method I would use.

--
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, originally posted via msnews.microsoft.com
"colblip" colonel.blip.at.bigfoot.com wrote in message
...
Same understanding here now (after all of you MVP folks have been working
with me). I noted in my latest message I took a different approach, tho
coding may be wrong, of checking for the picture file. Didn't work for
whatever reason.

Hello, Graham!
You wrote on Sat, 8 Aug 2009 17:41:05 +0300:

GM My understanding was that Mergefield Full_Name would always be true
for
GM every record so 'No Picture' would never be used.
GM The only way to do this I feel is to introduce another field or to
GM introduce blank images for each of the missing pictures named to match
GM the full_name..

GM --
GM
GM Graham Mayor - Word MVP

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

GM macropod wrote:
?? Hi Doug,
??
?? The field coding I've provided in microsoft.public.word.newusers does
?? exactly that! The field code the OP is using is: {INCLUDEPICTURE
?? "O:\\Pictures\\2009 Original Church Pictures\\{IF{MERGEFIELD
?? "Full_Name"}= "" "NoPicture" {MERGEFIELD "Full_Name"}}.JPG"} The OP's
?? problem is that, where there's no picture for the record, the image
?? from the previous record is being inserted. I believe this is caused
?? by the combination of a bug in Word 2007 and either: 1. the
'NoPicture.jpg'
?? file doesn't exist in the image folder; or 2. the supposedly 'empty'
?? picture name record isn't really empty
??
?? "Doug Robbins - Word MVP" wrote in message
?? ...
?? I am not sure that can be done using just a field construction. I
?? say that however in the realization that fellow MVP Macropod will
?? (as he usually does) come along and prove me wrong. However if you
?? use your Outlook data source to perform a Directory type mail merge
?? in the main document of which you insert the mergefields into the
?? cells of a one row table with the mergefield in the first cell being
?? that which contains the names, and you execute that merge to a new
?? document, you will then get a table with a row of data for each
?? record in the data source with the first column containing Joe &
?? Mary Harry & Sue John & Jill Sam & Linda Gary and Gertrude
??
?? Now, if you insert a new column to the right of that column and then
?? with that document as the active document, you run a macro
?? containing the following code: Dim Family As Range
?? Dim i As Long
?? Dim MyPath As String
?? Dim Picture As String
?? Dim picfile As String
?? Dim Flag As Boolean
?? With ActiveDocument.Tables(1)
?? For i = 1 To .Rows.Count
?? Flag = False
?? Set Family = .Cell(i, 1).Range
?? Family.End = Family.End - 1
?? picfile = Family.Text & ".jpg"
?? Picture = Dir$("O:\Pictures\2009 Original Church
?? Pictures\*.jpg") Do While Picture "" MsgBox Picture
?? If UCase(Picture) = UCase(picfile) Then .Cell(i,
?? 2).Range.Text = picfile Flag = True Exit
?? Do End If Picture = Dir Loop If Flag
?? = False Then .Cell(i, 2).Range.Text =
?? "NoPhotoAvailable.jpg" End If Next i End With
??
?? it will populate the cells in the second column with the picture
?? filename of the couple if it exists or with NoPictureAvailable.jpg
?? if it does not so that the first two cells of the table will then
?? contain Joe & Mary Joe & Mary.jpg
?? Harry & Sue NoPictureAvailable.jpg
?? John & Jill John & Jill.jpg
?? Sam & Linda NoPictureAvailable.jpg
?? Gary and Gertrude Gary & Gertrude.jpg
??
?? Now you can insert a row at the top of the table into the cells of
?? which you insert the names of the mergefields (not the mergefields
?? themselves) and save this document and use it as the data source for
?? the merge that you originally wanted to create. --
?? 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, originally posted via msnews.microsoft.com
?? "colblip" colonel.blip.at.bigfoot.com wrote in message
?? ...
?? Doug, macropod,
??
?? I need to drop back the better part of the field and start over.
?? I'm getting a bit overwhelmed. Further, I'll keep it in one group
?? and continue one thread rather than two. Currently I run a mail
?? merge out of Outlook with names, addresses etc. Let's say this
?? produces 5 records, Joe & Mary Harry & Sue John & Jill Sam &
?? Linda Gary and Gertrude
??
?? I have 3 photos for these five families
??
?? Joe & Mary.jpg
?? John & Jill.jpg
?? Gary and Gertrude.jpg
?? and I have a picture - NoPictureAvailable.jpg.
??
?? As my mail merge document now exists I produce a page with each
?? record having a photo of the family with their name, address, etc
?? listed under the photo. All of the photos are in a folder -
?? O:\Pictures\2009 Original Church Pictures. My photo area of the
?? merge has the code: {INCLUDEPICTURE "O:\\Pictures\\2009 Original
Church
?? Pictures\\{ Mergefield "Full_Name"}.JPG" } in it. I run the merge,
I
?? do a cntl-A and F9 and all of the pictures load appropriately. The
?? problem is - for the "Harry & Sue" and "Sam & Linda" merged records
?? there is no corresponding photos. My desire is to load a dummy
?? picture, NoPhotoAvailable, for these two records. The BF&A approach
?? would be to copy/rename the NoPhotoAvailable.jpg to "Harry &
?? Sue.jpg" and "Sam & Linda.jpg" and everything would work fine.
?? However, I was hoping to make the code such that loading
?? "NoPhotoAvailable.jpg" could be made to occur if there was no
family
?? picture in my picture folder. Just for completeness I do know I
?? have to use cntrl-F9 for the braces and I've constructed all of the
?? code using Insert|Field... for any of the operators. I do wish
there
?? was a simple way to print out my code in text so it could be copied
?? and pasted in documents like this a text rather than having to type
?? it all in. :-( I hope this helps better explain what I am trying to
?? do. Thanks for your help AND patience on all of this. "colblip"
?? colonel.blip.at.bigfoot.com wrote in
?? message ...
?? Hello, All!
?? I have a directory I print for the church. In it I have insert a
?? picture of the family with the code {INCLUDEPICTURE
?? "O:\\Pictures\\2009 Original Church Pictures\\{ Mergefield
?? "Full_Name"}.JPG" }. I would like to insert a standard
?? NoPictureAvailable.jpg file if there is no picture for the family
?? in question. Is there a way to do this? Thanks,
??
?? Colonel Blip
?? E-mail: colonel.blip.at.bigfoot.com


With best regards, colblip. E-mail: colonel.blip.at.bigfoot.com




  #16   Report Post  
Posted to microsoft.public.word.mailmerge.fields
colblip colblip is offline
external usenet poster
 
Posts: 19
Default Merging pictures

"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:"

You are correct about my field data; however I am using Word 2003.
Therefore I tried the code you posted but it still doesn't work.
I think it is time for me to just give up on automating this. Thanks
for all of your efforts to help.


Doug, macropod,

I need to drop back the better part of the field and start over. I'm
getting a bit overwhelmed. Further, I'll keep it in one group and
continue one thread rather than two.

Currently I run a mail merge out of Outlook with names, addresses
etc. Let's say this produces 5 records,

Joe & Mary
Harry & Sue
John & Jill
Sam & Linda
Gary and Gertrude

I have 3 photos for these five families

Joe & Mary.jpg
John & Jill.jpg
Gary and Gertrude.jpg
and I have a picture - NoPictureAvailable.jpg.

As my mail merge document now exists I produce a page with each
record having a photo of the family with their name, address, etc listed
under the photo. All of the photos are in a folder -
O:\Pictures\2009 Original Church Pictures.

My photo area of the merge has the code: {INCLUDEPICTURE
"O:\\Pictures\\2009 Original Church Pictures\\{ Mergefield
"Full_Name"}.JPG" } in it.

I run the merge, I do a cntl-A and F9 and all of the pictures load
appropriately. The problem is - for the "Harry & Sue" and "Sam &
Linda" merged records there is no corresponding photos. My desire is
to load a dummy picture, NoPhotoAvailable, for these two records.
The BF&A approach would be to copy/rename the NoPhotoAvailable.jpg to
"Harry & Sue.jpg" and "Sam & Linda.jpg" and everything would work
fine. However, I was hoping to make the code such that loading
"NoPhotoAvailable.jpg" could be made to occur if there was no family
picture in my picture folder.

Just for completeness I do know I have to use cntrl-F9 for the
braces and I've constructed all of the code using Insert|Field... for
any
of the operators.

I do wish there was a simple way to print out my code in text so it
could be copied and pasted in documents like this a text rather than
having to type it all in. :-(

I hope this helps better explain what I am trying to do. Thanks for
your help AND patience on all of this.

"colblip" colonel.blip.at.bigfoot.com wrote in message
...
Hello, All!
I have a directory I print for the church. In it I have insert a
picture of the family with the code {INCLUDEPICTURE
"O:\\Pictures\\2009 Original Church Pictures\\{ Mergefield
"Full_Name"}.JPG" }. I would like to insert a standard
NoPictureAvailable.jpg file if there is no picture for the family
in question. Is there a way to do this?

Thanks,

Colonel Blip
E-mail: colonel.blip.at.bigfoot.com


With best regards, colblip. E-mail: colonel.blip.at.bigfoot.com


Hello, macropod!
You wrote on Sun, 9 Aug 2009 01:11:33 +1000:

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

m --
m Cheers
m macropod
m [Microsoft MVP - Word]


  #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}"}}}

  #18   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Doug Robbins - Word MVP Doug Robbins - Word MVP is offline
external usenet poster
 
Posts: 8,832
Default Merging pictures

Peter,

Using

{INCLUDETEXT {IF TRUE "C:\\Test_Files\\ThisFileDoesNotExist.JPG"} \c
Recover }

results in nothing being displayed in 2007, but using

{INCLUDETEXT {IF TRUE "C:\\Test_Files\\ThisFileDoesExist.JPG"} \c Recover }

sort of predictably results in the following error message:

"There are too many spelling or grammatical errors in Document1 to continue
displaying them. To check the spelling and grammar of this document, choose
Spelling and Grammar from the Review tab."

without the \c recover, I get the File Conversion dialog box in which I get
the opportunity to select the encoding that makes your document readable.

It's a pity word does not have an { IF ERROR } field.
--
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, originally posted via msnews.microsoft.com
"Peter Jamieson" wrote in message
...
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}"}}}


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

Thanks Doug.

Of course I'd wrapped the INCLUDETEXT in an IF so that all it appears to
do is check the result, but my test jpegs are quite small so maybe they
just don't trigger the problem.

without the \c recover, I get the File Conversion dialog box in which I
get the opportunity to select the encoding that makes your document
readable.


Yes, in Word 2007, using the Recover text from any file converter was
the only way I could find a couple of years ago to prevent Word from
popping up the encoding dialog. Most of the other converters are
unlikely to work at all as they probably wouldn't recognise the format
as valid. I guess it would be possible to write a converter that's
associated with .jpg files and just returns a short string whatever the
file content, but then you have to distribute and maintain the darned
thing. Even then, unless the new text file conversion interface in Word
2007 SP2 works differently in this respect, Word always checks file
existence itself so you still have to deal with merge-time errors.

It's a pity word does not have an { IF ERROR } field.


Yes. Seems unlikely to happen these days though...


Peter Jamieson

http://tips.pjmsn.me.uk

Doug Robbins - Word MVP wrote:
Peter,

Using

{INCLUDETEXT {IF TRUE "C:\\Test_Files\\ThisFileDoesNotExist.JPG"} \c
Recover }

results in nothing being displayed in 2007, but using

{INCLUDETEXT {IF TRUE "C:\\Test_Files\\ThisFileDoesExist.JPG"} \c Recover }

sort of predictably results in the following error message:

"There are too many spelling or grammatical errors in Document1 to
continue displaying them. To check the spelling and grammar of this
document, choose Spelling and Grammar from the Review tab."

without the \c recover, I get the File Conversion dialog box in which I
get the opportunity to select the encoding that makes your document
readable.

It's a pity word does not have an { IF ERROR } field.

  #20   Report Post  
Posted to microsoft.public.word.mailmerge.fields
JeanD JeanD is offline
external usenet poster
 
Posts: 1
Default Merging pictures

On Aug 8, 6:28*pm, "colblip" colonel.blip.at.bigfoot.com wrote:
"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:"

* * * * You are correct about my field data; however I am using Word 2003.
Therefore I tried the code you posted but it still doesn't work.
* * * * I think it is time for me to just give up on automating this. Thanks
for all of your efforts to help.





Doug, macropod,


I need to drop back the better part of the field and start over. I'm
getting a bit overwhelmed. Further, I'll keep it in one group and
continue one thread rather than two.


Currently I run a mail merge out of Outlook with names, addresses
etc. Let's say this produces 5 records,


Joe & Mary
Harry & Sue
John & Jill
Sam & Linda
Gary and Gertrude


I have 3 photos for these five families


Joe & Mary.jpg
John & Jill.jpg
Gary and Gertrude.jpg
and I have a picture - NoPictureAvailable.jpg.


As my mail merge document now exists I produce a page with each
record having a photo of the family with their name, address, etc listed
under the photo. All of the photos are in a folder -
O:\Pictures\2009 Original Church Pictures.


My photo area of the merge has the code: {INCLUDEPICTURE
"O:\\Pictures\\2009 Original Church Pictures\\{ Mergefield
"Full_Name"}.JPG" } in it.


I run the merge, I do a cntl-A and F9 and all of the pictures load
appropriately. The problem is - for the "Harry & Sue" and "Sam &
Linda" merged records there is no corresponding photos. My desire is
to load a dummy picture, NoPhotoAvailable, for these two records.
The BF&A approach would be to copy/rename the NoPhotoAvailable.jpg to
"Harry & Sue.jpg" and "Sam & Linda.jpg" and everything would work
fine. However, I was hoping to make the code such that loading
"NoPhotoAvailable.jpg" could be made to occur if there was no family
picture in my picture folder.


Just for completeness I do know I have to use cntrl-F9 for the
braces and I've constructed all of the code using Insert|Field... for
any
of the operators.


I do wish there was a simple way to print out my code in text so it
could be copied and pasted in documents like this a text rather than
having to type it all in. :-(


I hope this helps better explain what I am trying to do. Thanks for
your help AND patience on all of this.


"colblip" colonel.blip.at.bigfoot.com wrote in message
...
Hello, All!
I have a directory I print for the church. In it I have insert a
picture of the family with the code {INCLUDEPICTURE
"O:\\Pictures\\2009 Original Church Pictures\\{ Mergefield
"Full_Name"}.JPG" }. I would like to insert a standard
NoPictureAvailable.jpg file if there is no picture for the family
in question. Is there a way to do this?


Thanks,


Colonel Blip
E-mail: colonel.blip.at.bigfoot.com


With best regards, colblip. *E-mail: colonel.blip.at.bigfoot.com


Hello, macropod!
You wrote *on Sun, 9 Aug 2009 01:11:33 +1000:

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

*m --
*m Cheers
*m macropod
*m [Microsoft MVP - Word]- Hide quoted text -

- Show quoted text -


Ouch, ouch, ouch! Shameless plug, but this thread is screaming out for
a painless solution: just use a commercial Word addin called OnMerge
(www.onmerge.com) which automates inserting pictures into mail merges,
AND it can automatically substitute in a designated default image if
any of the pictures referenced by the merge fields is unavailable (or
if the file name is blank). It works with a GUI, so no manual field
coding in the first place.
Reply
Thread Tools
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Mail Merging Pictures Té Mailmerge 1 June 23rd 09 07:13 AM
I don't see previews of the pictures in my sample pictures folder Eliza Microsoft Word Help 0 January 23rd 08 01:40 AM
Merging pictures along with data... Evan Lapka Mailmerge 12 June 22nd 07 08:03 PM
Mail merging pictures from Access to Word Hammond-Wandsworth Mailmerge 1 December 11th 06 06:09 PM
Merging pictures - maybe one for Graham? ShaneS Mailmerge 2 July 1st 05 02:46 AM


All times are GMT +1. The time now is 07:38 PM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"