Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 04-25-2013, 08:13 PM
Elena Elena is offline Using IncludePicture and MailMerge to insert picture Windows 8 Using IncludePicture and MailMerge to insert picture Office 2010 64bit
Novice
Using IncludePicture and MailMerge to insert picture
 
Join Date: Apr 2013
Posts: 1
Elena is on a distinguished road
Angry Using IncludePicture and MailMerge to insert picture

Hello,


I am working on this project in which I am trying to create a directory of all the members of a club. I have been able to make all fields work but the picture. Whatever I do, I keep getting an error message "The linked image cannot be displayed. The file might have been moved, renamed, or deleted. Verify that the link points to the correct file and location."

The strange thing is that the field works when I format it this way:

INCLUDEPICTURE "C:\\Users\\Elena\\Pictures\\Ivonne.png"

But when I add the MergeField function, it give me the error message:

INCLUDEPICTURE "C:\\Users\\Elena\\Pictures\\{Mergefield \“Picture\”}.png"

In the datasource for the MergeField, the column with the header "Picture" has the name of the file. For example, it would have Ivonne following the example described above.

Any help you can provide would be really appreciated.
Thanks,
Reply With Quote
  #2  
Old 04-25-2013, 10:10 PM
macropod's Avatar
macropod macropod is offline Using IncludePicture and MailMerge to insert picture Windows 7 64bit Using IncludePicture and MailMerge to insert picture Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,956
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Your INCLUDEPICTURE field for the merge is wrong. It should be:
{INCLUDEPICTURE "C:\\Users\\Elena\\Pictures\\{Mergefield Picture}.png"}

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\Elena\Pictures\«Picture»"} \d} {INCLUDEPICTURE {IF TRUE "C:\Users\Elena\Pictures\«Picture»"} \d}}
or
{IF {INCLUDEPICTURE {IF TRUE "C:\Users\Elena\Pictures\{MERGEFIELD Picture}"} \d} {INCLUDEPICTURE {IF TRUE "C:\Users\Elena\Pictures\{MERGEFIELD Picture}"} \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»\«Picture»"} \d} {INCLUDEPICTURE {IF TRUE "«FilePath»\«Picture»"} \d}}
or
{IF {INCLUDEPICTURE {IF TRUE "{MERGEFIELD FilePath}\{MERGEFIELD Picture}"} \d} {INCLUDEPICTURE {IF TRUE "{MERGEFIELD FilePath}\{MERGEFIELD Picture}"} \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 «Picture»} \d} {INCLUDEPICTURE {IF TRUE «Picture»} \d}}
or
{IF {INCLUDEPICTURE {IF TRUE {MERGEFIELD Picture}} \d} {INCLUDEPICTURE {IF TRUE {MERGEFIELD Picture}} \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\\«Picture»"} \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]
Reply With Quote
  #3  
Old 05-05-2016, 06:39 AM
StaplerGnome StaplerGnome is offline Using IncludePicture and MailMerge to insert picture Windows 7 64bit Using IncludePicture and MailMerge to insert picture Office 2010 64bit
Novice
 
Join Date: May 2016
Posts: 8
StaplerGnome is on a distinguished road
Default

Thanks for this very helpful post, which I've used to set up some mail merge letters with digital signatures.

I've run into a problem, though, in that the images vanish when sent as attachments - presumably because the d-switch means they aren't saved. However, dropping the d-switch seems to prevent them being refreshed automatically.

I'm a bit confused because point 3 of the explanation suggests this won't be a problem.

Anyone have ideas to get around this behaviour?
Reply With Quote
  #4  
Old 05-05-2016, 08:22 PM
macropod's Avatar
macropod macropod is offline Using IncludePicture and MailMerge to insert picture Windows 7 64bit Using IncludePicture and MailMerge to insert picture Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,956
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

You would need to use one of the field code renditions before the first Note in post #2. Those will unlink the pictures from the source, so the pictures will be embedded in the output documents.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #5  
Old 05-06-2016, 01:04 AM
StaplerGnome StaplerGnome is offline Using IncludePicture and MailMerge to insert picture Windows 7 64bit Using IncludePicture and MailMerge to insert picture Office 2010 64bit
Novice
 
Join Date: May 2016
Posts: 8
StaplerGnome is on a distinguished road
Default

As far as I can tell, I am. Here's my code (transcribed because I can't copy-paste fields), [path] is where I removed the very long filepath to aid legibility here

{ IF { INCLUDEPICTURE { IF TRUE "[path]\{MERGEFIELD Signature }.png" } \d } { INCLUDEPICTURE { IF TRUE "[path]\{MERGEFIELD Signature }.png" } \d } }

Did I miss something? I'm not sure which part of your code should break the link, so I don't know what might be wrong.

I'm slightly confused by the d-switch, since the documentation suggests this would prevent an image being stored by the document, and I'd therefore expect it would *maintain* a link to the original image instead. That did seem to fit the results I was getting, where the image only appeared if it could find that filepath and name on the recipient computer.

(Documentation from here: https://documentation.devexpress.com...omDocument9713)
Reply With Quote
  #6  
Old 05-06-2016, 03:15 AM
macropod's Avatar
macropod macropod is offline Using IncludePicture and MailMerge to insert picture Windows 7 64bit Using IncludePicture and MailMerge to insert picture Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,956
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

The description in the link is quite correct, but my implementation breaks the field, leaving the image behind. If you have a look at some of the tutorials I've published on Word field coding, you'll see I do all sorts of things with them that are waaay out there...
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #7  
Old 05-06-2016, 04:30 AM
StaplerGnome StaplerGnome is offline Using IncludePicture and MailMerge to insert picture Windows 7 64bit Using IncludePicture and MailMerge to insert picture Office 2010 64bit
Novice
 
Join Date: May 2016
Posts: 8
StaplerGnome is on a distinguished road
Default

Unfortunately it doesn't seem to be working as expected. With the code above, if I save a merged letter and send it as an attachment, the image is still linked to the original. So if I view it from another computer, or change the filename on the drive, the image can't be displayed.
Reply With Quote
  #8  
Old 05-06-2016, 04:36 AM
macropod's Avatar
macropod macropod is offline Using IncludePicture and MailMerge to insert picture Windows 7 64bit Using IncludePicture and MailMerge to insert picture Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,956
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

If you have implement the field code as posted, it cannot remain linked.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #9  
Old 05-06-2016, 05:03 AM
StaplerGnome StaplerGnome is offline Using IncludePicture and MailMerge to insert picture Windows 7 64bit Using IncludePicture and MailMerge to insert picture Office 2010 64bit
Novice
 
Join Date: May 2016
Posts: 8
StaplerGnome is on a distinguished road
Default

I've just tried doing it again from scratch. I copy-pasted your formula from above (the {IF {INCLUDEPICTURE {IF TRUE "C:\Users\Elena\Pictures\{MERGEFIELD Picture}"} \d} {INCLUDEPICTURE {IF TRUE "C:\Users\Elena\Pictures\{MERGEFIELD Picture}"} \d}} variant) and swapped in my fields. And replaced the brackets with Ctrl-F9 of course.

When emailed, the picture is still linked. Viewed with Alt-F9, it displays an INCLUDEPICTURE with the link to the file ending in \* MERGEFORMATINET. If the file is not where expected, it displays the standard "linked picture cannot be displayed" message and red-cross image.

I tested it side-by-side with my original - the two look to be identical and behave in exactly the same way.

I can't copy-paste it because Word doesn't let me do that with field codes. I've uploaded a screenshot; annoyingly the forum rejects the URL for some reason, but it's here for 28 days: http://www.tiikoni.com/tis/view/?id=be05946

The resulting code in the saved, emailed document is here:
http://www.tiikoni.com/tis/view/?id=4c62eb0

Since the image cannot remain linked if the code is correct, can you suggest what is wrong with the code? I'm stuck. The only discrepancy I can think of is that the image is on a shared drive (M rather than on the hard drive. However, that's not an option.
Reply With Quote
  #10  
Old 05-06-2016, 05:34 AM
macropod's Avatar
macropod macropod is offline Using IncludePicture and MailMerge to insert picture Windows 7 64bit Using IncludePicture and MailMerge to insert picture Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,956
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Try the attached. I've edited a known good copy of the field code to employ what I think is your paths & field name - check before using. You should be able to simply connect the attachment to your data source, then finish the merge.

The images being on a server should have no bearing on the outcome.
Attached Files
File Type: doc MailMerge Image Test.doc (34.0 KB, 142 views)
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #11  
Old 05-06-2016, 07:10 AM
StaplerGnome StaplerGnome is offline Using IncludePicture and MailMerge to insert picture Windows 7 64bit Using IncludePicture and MailMerge to insert picture Office 2010 64bit
Novice
 
Join Date: May 2016
Posts: 8
StaplerGnome is on a distinguished road
Default

Thanks, I've given it a try. Well, this is interesting.

I connected the file to the data source. For general use, it's fine; the images of signatures appeared as expected. I then tried two versions of emailing:
For the first I simply saved and emailed myself a copy of the file without any other changes.
For the second, I ran Finish & Merge on the current record, then emailed it to myself.

Both versions display the signatures I expected. However, it's still looking in the M drive location. If I rename the file or otherwise make it unavailable, the link breaks and the image doesn't display.

I've tried both .doc and .docx versions to make sure it's not a compatibility issue, but no joy.
Reply With Quote
  #12  
Old 05-06-2016, 07:24 AM
macropod's Avatar
macropod macropod is offline Using IncludePicture and MailMerge to insert picture Windows 7 64bit Using IncludePicture and MailMerge to insert picture Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,956
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

There should be no links post-merge. Are you actually finishing the merge, or just previewing it? As for emailing, are you finishing the merge, then saving & attaching the output document, or are you merging direct to email?
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #13  
Old 05-06-2016, 07:44 AM
StaplerGnome StaplerGnome is offline Using IncludePicture and MailMerge to insert picture Windows 7 64bit Using IncludePicture and MailMerge to insert picture Office 2010 64bit
Novice
 
Join Date: May 2016
Posts: 8
StaplerGnome is on a distinguished road
Default

No, I'm finishing it, using the Finish & Merge function.

The original document, once fed a data source, offers the full mailing functions and multiple records. I hit Finish & Merge, Merge to New Document (Current Record), and get a fresh document containing a single record and not linked to any data sources. This has no field codes so Alt-F9 does nothing.

Once saved, File > Edit Links to Files shows that the new document is linked to the image on my M drive. It retains this link when emailed.

Screenshot at http://www.tiikoni.com/tis/view/?id=b82524c
Reply With Quote
  #14  
Old 05-06-2016, 10:21 AM
macropod's Avatar
macropod macropod is offline Using IncludePicture and MailMerge to insert picture Windows 7 64bit Using IncludePicture and MailMerge to insert picture Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,956
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Hmm, it seems a Word update somewhere along the line has broken what was a perfectly good method for unlinking images during a mailmerge. Now all you get with that approach is linked images you can no longer access via any of the usual field methods. All is not lost, though. If you use the shorter version of the field:
{INCLUDEPICTURE {IF TRUE "C:\Users\Elena\Pictures\{MERGEFIELD Picture}"} \d}
you can still unlink the fields immediately after merging (e.g. via Ctrl-A, Ctrl-Shift-F9).
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #15  
Old 05-18-2016, 08:54 AM
StaplerGnome StaplerGnome is offline Using IncludePicture and MailMerge to insert picture Windows 7 64bit Using IncludePicture and MailMerge to insert picture Office 2010 64bit
Novice
 
Join Date: May 2016
Posts: 8
StaplerGnome is on a distinguished road
Default

Thanks Macropod, that does seem to work now!

I don't suppose you know of any way to do this automatically, such as via a macro? There will be a lot of these letters to generate, and in particular my colleagues are going to struggle to remember to follow a hotkey routine.
Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Using IncludePicture and MailMerge to insert picture Insert Picture changes colors rowan.bradley Drawing and Graphics 6 05-18-2013 05:26 PM
Using IncludePicture and MailMerge to insert picture Macro to insert picture in footer Sharon Word 5 01-29-2013 03:12 AM
Using IncludePicture and MailMerge to insert picture insert picture file location gary1 Word 9 12-16-2012 04:37 PM
Using IncludePicture and MailMerge to insert picture Macro for Picture Insert rfhall50 Word VBA 2 10-25-2010 12:41 PM
Using IncludePicture and MailMerge to insert picture Can I insert a picture into a picture ? alexcalgary Drawing and Graphics 2 10-16-2010 03:29 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 03:40 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft