?
Solved

MS Word 2003 Formatting merged fields

Posted on 2006-06-12
7
Medium Priority
?
1,190 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
On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

 
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 1000 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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

A few years ago I was very much a beginner at VBA, and that very much remains the case today.  I'll do my best to explain things as I go in the hope that other beginners can follow.  If you just want to check out a tool that creates a Select Case fu…
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…
This video shows where to find templates, what they are used for, and how to create and save a custom template using Microsoft Word.
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…
Suggested Courses

764 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