Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Word mailmerge dynamically set color

Posted on 2012-09-03
2
Medium Priority
?
1,996 Views
Last Modified: 2013-08-29
Hello,

I have a mail merge template which is supposed to fill the background of the document with a specific colour that is dynamically calculated by certain fields of the excel source.

I.e. if field "country" eq "Germany" then display background in green.
"Country" eq "Spain" display background in red.

Is that possible?
Any help is greatly appreciated.
0
Comment
Question by:arthrex
2 Comments
 
LVL 50
ID: 38360762
Hello,

as far as I know, you cannot set the background colour of a Word document based on the value of a mail merge field.

You CAN set the colour of the text of in a mail merge document by creating an IF statement along the lines of

{ IF {mergefield MyField} = "this" "This text" "That text"}

Inside the IF statement you can format "This text" and "That text" to have different formatting, like font, colour, paragraph background, etc.

The document background is on a different level, though.

You may want to use a separate merge document for each different background colour and then filter the data source by the country field, so the "green" merge document only receives the records for "Germany" and the "red" merge document only receives the records for "Spain".

cheers, teylyn
0
 
LVL 77

Accepted Solution

by:
GrahamSkan earned 1500 total points
ID: 38361030
A single mail merge operation to a result document produces only the one document. Page background colour applies to the whole document, so even if Word Field logic could apply a background colour it couldn't provide the different colours required.

If your skill level is sufficient for future maintenance, it would be possible to run the merge as separate merges under VBA control, so that the code would colour each output document individually.
0

Featured Post

Nothing ever in the clear!

This technical paper will help you implement VMware’s VM encryption as well as implement Veeam encryption which together will achieve the nothing ever in the clear goal. If a bad guy steals VMs, backups or traffic they get nothing.

Question has a verified solution.

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

Deploying a Microsoft Access application in a Citrix environment is not difficult but takes a few steps. However, Citrix system people are often of little help, as they typically know next to nothing about Access. The script provided here will take …
Technology opened people to different means of presenting information, but PowerPoint remains to be above competition. Know why PPT still works today.
The viewer will learn how to simulate a series of sales calls dependent on a single skill level and learn how to simulate a series of sales calls dependent on two skill levels. Simulating Independent Sales Calls: Enter .75 into cell C2 – “skill leve…
Learn how to create and modify your own paragraph styles in Microsoft Word. This can be helpful when wanting to make consistently referenced styles throughout a document or template.

581 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