Solved

Variable Pictures in MS Word 2007/2010

Posted on 2012-04-03
6
428 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
Does Powershell have you tied up in knots?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

 

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

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
blinking flashing cursor while in MS Word 8 57
Printing A1 on A4 Printer 8 159
CheckBox Not Recognized as True When Checked 3 35
MS Word document > cursor placement 5 33
This is written from a 'VBA for MS Word' perspective, but I am sure it applies to most other MS Office components where VBA is used.  One thing that really bugs me is slow code, ESPECIALLY when it's mine!  In programming there are so many ways to…
Preface: When I started this series, I used the term CommandBars because that is the Office Object class that it discusses. Unfortunately, when Microsoft introduced Office 2007, they replaced the standard Commandbar menus with "The Ribbon" and rem…
This video shows and describes the main difference between both orientations in Microsoft Word. Viewers will understand when to use each orientation and how to get the most out of them.
This video shows where to find the word count, how to display it, and what it breaks down to in Microsoft Word.

777 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