View Single Post
  #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