Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Word Merge Substitute for Ugly Abbreviations

Status
Not open for further replies.
Oct 27, 2009
30
US
Hi, all,
I am working with Word 2007 mail merge document. The data source used for the document has some "ugly" abbreviations, such as 10ACP, etc., that are necessary to the database that feeds the merge document. Is there a way to automatically change the 10ACP to 2010 Annual Campaign (or similar) in the merge document? There will be various abbreviations and various substitutions for those.
TIA
 
I was thinking the same thing but then second guessed myself by thinking "It can't be THAT simple."

--
JP
 
Hi susieqtotallynew,

In your mailmerge main document, you could use IF fields to parse the problem data field(s). For example, suppose the problem field is named 'MyData' and contains both abbreviated and non-abbreviated text. In word, you could:
. duplicate the mailmerge field to be tested (eg «MyData») so that you get «MyData»«MyData»;
. select both fields and Press Ctrl-F9 to enclose them in a new field, thus {«MyData»«MyData»};
. fill in around the new field braces so that you end up with {IF«MyData»= "10ACP" "2010 Annual Campaign" «MyData»}

If there are multiple possible abbreviations, you can nest the IF tests. For example:
{IF«MyData»= "10ACP" "2010 Annual Campaign" {IF«MyData»= "12ACP" "2012 Annual Campaign" «MyData»}}

Alternatively, if the 'MyData' field only has abbreviations, you could code a series of IF tests along the lines of:
{IF«MyData»= "10ACP" "2010 Annual Campaign"}{IF«MyData»= "12ACP" "2012 Annual Campaign"}

Note: The field brace pairs (ie '{ }') for the above example are created via Ctrl-F9 - 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
[MS MVP - Word]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top