Solved

Variable Pictures in MS Word 2007/2010

Posted on 2012-04-03
6
423 Views
Last Modified: 2012-04-11
I have an application that uses MS Word (2007 & 2010) for mail merges.  What I want is to embed a dynamic photo based on a field in the datasource.   The field contains a url to the end users photo.  ie.  FieldName: photolocation
Field Value  http://www.hostingsite/user.jpg

I have used the following without success.

{INCLUDEPICTURE "{IF TRUE { MERGEFIELD «photolocation» }}"}

Result:   Displays "http://www.hostingsite/user.jpg" and not the embedded picture.

Explicit Example  (tried with and without quotes around URL:
{INCLUDEPICTURE "{IF TRUE { "http://www.hostingsite/user.jpg” }}"}

Any help would be greatly appreciated.
Thanks in advance.
0
Comment
Question by:ulcsupport
  • 3
  • 2
6 Comments
 
LVL 9

Assisted Solution

by:damerval
damerval earned 500 total points
ID: 37802472
Hi,
There is a bug in Word 2007/2010 that Microsoft is aware of regarding the IncludePicture field. If you save your document as a word 97-2003 file, you will get better results.
Also, make sure all the pointers and details from this link:
http://wordnut.hubpages.com/hub/IncludePicture
are taken into account. I have just run an example using some random images from a google search, and it seems to work. The doubling up of the slashes is important.

HTH,

Philippe
0
 
LVL 76

Expert Comment

by:GrahamSkan
ID: 37802553
It's not clear what the IF field is there for. Try this:

{INCLUDEPICTURE “{ MERGEFIELD «photolocation» }”}
0
 
LVL 76

Expert Comment

by:GrahamSkan
ID: 37803058
Sorry. I have mixed up the views.

It should just be
{INCLUDEPICTURE “«photolocation»”}

or with the Mergefield code displayed:
{INCLUDEPICTURE “{ MERGEFIELD photolocation }”}
0
What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

 

Accepted Solution

by:
ulcsupport earned 0 total points
ID: 37816132
I was able to find a solution to this.   The coding solutions were correct,  however, it was necessary to do a CRL-A to select all fields and then F9 to update the merge fields.   This worked only when saving in Word 2003 format.  I was not successful getting this to work in Office 2007/2010, apparently due to a known bug.
0
 
LVL 76

Expert Comment

by:GrahamSkan
ID: 37816488
The merge process itself should automatically update fields, so I doubt that was the real answer, though it may account for the strange-looking field codes that you reported in the question.

What bug prevents merge from working in Word 2007?  Perhaps we can find a workaround.
0
 

Author Closing Comment

by:ulcsupport
ID: 37831656
I was able to find a solution to this.   The coding solutions were correct,  however, it was necessary to do a CRL-A to select all fields and then F9 to update the merge fields.   This worked only when saving in Word 2003 format.  I was not successful getting this to work in Office 2007/2010, apparently due to a known bug.
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

The Selection object is designed for user interaction. It has a Range property, so it can be used in most places that a Range object can. Recorded macros must use the Selection because they are simply copying what the user is doing. A Range prope…
Microsoft Word is a program we have all encountered at some point, but very few of us have dug deep into its full scope of features, let alone customized it to suit our needs. Luckily making the ribbon (aka toolbar, first introduced in Word 2007) wo…
This video shows where to find the word count, how to display it, and what it breaks down to in Microsoft Word.
This video shows where to find templates, what they are used for, and how to create and save a custom template using Microsoft Word.

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now