#1
|
|||
|
|||
Pictorial directory using mailmerge
In Word 2003, I want to use mailmerge to create a pictorial directory.
Each page will be a table with 3 columns and 4 rows. Each cell will contain a picture and a caption. Currently, in MyDocuments, I have folder named "PictorialDirectory". There are two items: 1. A subfolder named "Pictures" which has the jpg files. 2. A csv file with two colums, named "Filename" and "Caption". Each caption is a text string, and each file name refers to a jpg file in the "Pictures" subfolder. The jpg file names include the person's name and the original file name created by the camera, plus a revision (editing) number. For example, "Jones Steve IMG00123r1.jpg". I'm not quite sure how to use the IncludePicture command. Thanks for any help, John |
#2
|
||||
|
||||
Hi John,
When embedding a mailmerge field in an INCLUDEPICTURE field for the purpose of merging graphics: 1. the filepaths to the fields 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 later delete the image or you need to send the merged output to someone else. The following field construction addresses all three issues (i.e. you don't need to do anything special to the paths, or refresh the fields, and they'll no longer be linked to the source files): {IF {INCLUDEPICTURE {IF TRUE "C:\Users\My Document Path\Pictures\«Image»"} \d} {INCLUDEPICTURE {IF TRUE "C:\Users\My Document Path\Pictures\«Image»"} \d}} or {IF {INCLUDEPICTURE {IF TRUE "C:\Users\My Document Path\Pictures\{MERGEFIELD Image}"} \d} {INCLUDEPICTURE {IF TRUE "C:\Users\My Document Path\Pictures\{MERGEFIELD Image}"} \d}} After running a mailmerge coded this way, you'll have the correct, unlinked image for each record. This form of field construction can be very useful where the filepath for the images is held in the mailmerge data source, in which case you could use: {IF {INCLUDEPICTURE {IF TRUE "«FilePath»\«Image»"} \d} {INCLUDEPICTURE {IF TRUE "«FilePath»\«Image»"} \d}} or {IF {INCLUDEPICTURE {IF TRUE "{MERGEFIELD FilePath}\{MERGEFIELD Image}"} \d} {INCLUDEPICTURE {IF TRUE "{MERGEFIELD FilePath}\{MERGEFIELD Image}"} \d}} Note: You need a path separator between the filepath mergefield and the image mergefield. If that separator is included in the source data, it can be omitted from the field above construction but leaving it there has no adverse effects either. If the path data are included with in the image field, you can use: {IF {INCLUDEPICTURE {IF TRUE «Image»} \d} {INCLUDEPICTURE {IF TRUE «Image»} \d}} or {IF {INCLUDEPICTURE {IF TRUE {MERGEFIELD Image}} \d} {INCLUDEPICTURE {IF TRUE {MERGEFIELD Image}} \d}} For what it's worth, *provided* the path has the separators expressed as '\\' or '/', you can retain the links by omitting the all-encompassing IF test and the images will display correctly without the need to refresh the fields after completing the merge. For example: {INCLUDEPICTURE {IF TRUE "C:\\Users\\My Document Path\\Pictures\\«Image»"} \d} Note: The field brace pairs (ie '{ }') for the above examples are created in the body of the document via Ctrl-F9 (Cmd-F9 on a Mac) - you can't simply type them or copy & paste them from this message. Likewise, you can't type or copy & paste the chevrons (ie '« »') - they're part of the actual mergefields, which you can insert from the mailmerge toolbar.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#3
|
|||
|
|||
Thanks, Paul
I'll give it a shot after my morning coffee tomorrow.
We retired folks probably work harder at these things. I guess that's appropriate for the big bucks (not) we earn. John |
#4
|
|||
|
|||
Error! Filename not specified.
Thanks again, Paul, for your help.
I tried to keep it simple. My Excel data sheet has headings: "Picture" for the combined path and picture filename. The first entry below the header is "C:\\Documents and Settings\\John\\My Documents\\FPC\\Directory\\DirectoryPhotos\\Abels_ Jon_1011_DSCF2804r.jpg", with quotes. "Filename". The first entry is Abels_Jon_1011_DSCF2804r.jpg, no quotes. "Caption". The first entry is Jon and Lily Abels, no quotes. The first cell in the Word document contains the following: { INCLUDEPICTURE { MERGEFIELD “Picture” } \* MERGEFORMAT } { MERGEFIELD “Filename” } { MERFIELD “Caption” } { NEXT } I press <Alt + F9> and get Error! Filename not specified. Abels_Jon_1011_DSCF2804r.jpg Jon and Lily Abels I must be overlooking something. John |
#5
|
||||
|
||||
Hi John,
Aside from the fact you haven't implemented the code as I suggested (which is up to you), you don't need the '\* MERGEFORMAT' switch and, with the code you're using, the INCLUDEPICTURE field won't resolve correctly: • without the filepath; • until the mailmerge is executed. If '{ MERGEFIELD “Filename” }' only returns 'Abels_Jon_1011_DSCF2804r.jpg', that means you need to add the path to either: • the filenames in the data; or • the INCLUDEPICTURE field (with double quotes encompassing it and the Filename mergefield.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#6
|
|||
|
|||
Why all the "IF" statements?
Paul, your last response wasn't too helpful. I had already set up my database with fields for the jpg filename ( hence {MERGEFIELD "Filename"} ) and for the combined path and filename ( hence {MERGEFIELD "Picture"} ). I believe had already handled path and filename correctly.
The only method which works for me is a two-step process: 1. Position the insertion point and do "Insert Picture from File", except complete using the insert "Link to file" option. The result is like { INCLUDEPICTURE "DirectoryPhotos/Abels_Jon_1011_DSCF2804r.jpg" \* MERGEFORMAT \d }. 2.Next, replace the actual filename with the filename field, hence { INCLUDEPICTURE "DirectoryPhotos/{Mergefield "Filename"}" \* MERGEFORMAT \d }. That said, I did implement your code, but with the two-step method above. My template has twenty pictures on a page, so it resembles a sheet of labels. When I execute "Merge to New Document", I get six pages containing my 113 pictures. The only frustration is that the seven photos on the bottom of page five are repeated on the bottom of page six. So...What are the purposes for your IF staements? Thanks! John My template |
#7
|
||||
|
||||
In your second post you said:
Quote:
Quote:
{INCLUDEPICTURE "{MERGEFIELD Picture}"} (Note that you don't need them inside the mergefield and you don't need the mergeformat switch). Even when you fix that, though, the INCLUDEPICTURE field may not resolve correctly until the merge is executed. If it doesn't you'll still see the 'Error! Filename not specified.' display, but the actual merge should work OK. The reason the more complicated versions of the field code I posted doesn't need the double quotes is that, when the merge is executed, the data are resolved and unlinked all in one go, so there's no INCLUDEPICTURE fields in the output document. In the simpler (last) version, you'll see that the double quotes are still there, as required. The IF TRUE test simply forces Word to resolve the data as the merge is executed; without it, users often have to refresh the links after the merge (eg via Print Preview or Ctrl-A, F9), to see all the images. As for the repeated data, that suggests you're using a letter merge. What you should be using is a label merge, with {NEXT} fields either: • at the end of every label except the last; or • at the start of every label except the first.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
Tags |
includepicture, mailmerge field |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Mailmerge to Email with a mailmerge attachment | Baldeagle | Mail Merge | 13 | 05-29-2012 02:04 PM |
question in pictorial representation | gsrikanth | Excel | 1 | 03-02-2012 11:45 AM |
Directory Mailmerge | rohitjain80 | Mail Merge | 1 | 02-12-2012 03:42 AM |
Active Directory | ababc | Misc | 0 | 09-19-2006 06:18 AM |
Active Directory | nukkumatti | Misc | 0 | 11-16-2005 08:42 AM |