Solved

MS Word 2003 Formatting merged fields

Posted on 2006-06-12
7
1,179 Views
Last Modified: 2016-08-29
Another program ACT! has the abitlity to merge its database fields into a Word template.  The resulting merged document results in all currency fields having no dollar sign nor commas.
The template field directly from the database would be -
<Additional Amt> resulting output - 15000.00
The underlying field code is -
{ DOCVARIABLE [ACTFIELD]TBL_CONTACT.CUST_AdditionalAmt_081859447 \*
MERGEFORMAT }
If I try to add formatting to it as in -
{ DOCVARIABLE [ACTFIELD]TBL_CONTACT.CUST_AdditionalAmt_081859447 \# ###.00
\* MERGEFORMAT }
It results in - <Additional Amt> outputed as plain text in the document.

I just need to get the fields formatted correctly, when pulling them into the template.

Thanks for any help.
0
Comment
Question by:gusevans
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
7 Comments
 
LVL 76

Expert Comment

by:GrahamSkan
ID: 16892075
You can put a dollar sign and add a comma in the numeric switch, e.g. :
\# $#,##0.00

So the whole thing would look like this:

 { DOCVARIABLE  [ACTFIELD]TBL_CONTACT.CUST_AdditionalAmt_081859447 \# $#,##0.00 \* MERGEFORMAT }

I have just tested it with a variable of the same name, and the resulting field is displayed as $15,000.00
0
 
LVL 17

Expert Comment

by:wobbled
ID: 16892224
For further information on this:

If you type the words "format fields" into word help you should see an option for Format (\*) field switch.  This will give you information on how to format the data returned on a field.
0
 

Author Comment

by:gusevans
ID: 16894096
GrahamSkan and wobbled,
I had done both and neither worked.  I have researched all Word Help MS Knowledge Base and Communities.  

When I insert the field in the template in Word using the ACT! addin and then do Alt-F9 to see the field codes, I can see { DOCVARIABLE [ACTFIELD]TBL_CONTACT.CUST_AdditionalAmt_081859447 \* MERGEFORMAT }.  But if I edit it by adding '/# $#,###.00' and then try to use it, it just gives me the field name as text - <Additional Amt>.

I have added over 500 fields to the database and ACT! support says that because it is so large a database it may not work.  They say it is a Microsoft problem not theirs.

Maybe thier is a way to use VBA and bookmarks to fix it???
0
[Webinar] Code, Load, and Grow

Managing multiple websites, servers, applications, and security on a daily basis? Join us for a webinar on May 25th to learn how to simplify administration and management of virtual hosts for IT admins, create a secure environment, and deploy code more effectively and frequently.

 
LVL 76

Expert Comment

by:GrahamSkan
ID: 16895250
Perhaps we just don't understand the problem. On the face of it, you have a document variable with that long name, and a value of 15000.00.

If that is the case, then the numeric switch should be able to format it.

Can you post the document here: http://www.ee-stuff.com/ so we can see it? Tell us back here in a comment.
0
 

Author Comment

by:gusevans
ID: 16899269
GrahamSkan,

Here is what I got from ee-stuff.com

The field in question is <Additional Amt>.

View all files for Question ID: 21884095
https://filedb.experts-exchange.com/incoming/ee-stuff/205-EE.ziphttps://filedb.experts-exchange.com/incoming/ee-stuff/206-EE2.zip
 

Direct link to your file
https://filedb.experts-exchange.com/incoming/ee-stuff/205-EE.zip 
0
 

Author Comment

by:gusevans
ID: 16899289

Below are links to 2 similar files using the same field in the same database, same contact record in a different template with different results ???

View all files for Question ID: 21884095
https://filedb.experts-exchange.com/incoming/ee-stuff/205-EE.ziphttps://filedb.experts-exchange.com/incoming/ee-stuff/206-EE2.zip
 

Direct link to your file
https://filedb.experts-exchange.com/incoming/ee-stuff/206-EE2.zip 
0
 
LVL 76

Accepted Solution

by:
GrahamSkan earned 250 total points
ID: 16900983
For each example, you have posted two files, a Word document, and a file with an extension of .adt. The latter file is, I suppose, a data file that the third party program uses to run its merge, which does not appear to based on Word's mail merge.

In the word document there is only one Word field - the current date.

The plain text <Additional Amt> is visible.

There are 34 document variables, including these two

             Name                                                                                             Value
[ACTFIELD]TBL_CONTACT.CUST_AdditionalAmt_081859447                           <Additional Amt>
[ACTFIELD]TBL_CONTACT.CUST_AdditionalAmt_081859447 \# #,###.0         [[ACTFIELD DELETE ME]]

I infer that the third party program adds the variables and corresponding DocVariable fields, plugging the default values such as <Additional Amt> with values from its database. It then unlinks all the fields leaving only the data. I guess that it gets confused with the formatting instruction, and cannot match it to its appropriate data base field. It might be trying to include the numeric switch when trying to extract the Document variable name

There is no evidence that it is a Word problem, because that numeric switch works OK normally. Even if it were a Word bug, we cannot analyse the way that the third party program works to have found such a bug.

However, it sounds pretty fundamental to me, so there may be something in their instructions. Document variable names can have spaces in them, so it might be worth enclosing the name with quotes.

{ DOCVARIABLE  "[ACTFIELD]TBL_CONTACT.CUST_AdditionalAmt_081859447" \# $#,##0.00 \* MERGEFORMAT }
0

Featured Post

Enroll in May's Course of the Month

May’s Course of the Month is now available! Experts Exchange’s Premium Members and Team Accounts have access to a complimentary course each month as part of their membership—an extra way to increase training and boost professional development.

Question has a verified solution.

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

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 article describes a method of delivering Word templates for use in merging Access data to Word documents, that requires no computer knowledge on the part of the recipient -- the templates are saved in table fields, and are extracted and install…
This video walks the viewer through the process of creating an MLA formatted document, as well as a bibliography with citations.
This video shows where to find templates, what they are used for, and how to create and save a custom template using Microsoft Word.

734 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