Solved

Extra spaces in number in Word 2007 merge field

Posted on 2012-03-14
5
364 Views
Last Modified: 2012-06-27
I've set up a Word doc with form fields that will be used to merge numerical data from Excel.  By default, the numbers lose their comma when they appear in Word, so I added a switch to the field code. For example: { MERGEFIELD  ADJUST \# ##,### }, where ADJUST is the column name in Excel.  The use of ##,### tells Word what the maximum number of digits will be in a number, and where to place the comma.  For numbers that don't require all those digits, each unnecessary # is replaced with a space.  So, for a small number like 200, the mergefield displays "[space][space]200".  This would be fine if my numbers were in a table, but these numbers are included in sentences, and the extra spaces are not acceptable. Is there an additional switch I can add to the mergefield code that will replace each unnecessary # with NOTHING instead of a space?
0
Comment
Question by:swpa_wnt
  • 4
5 Comments
 
LVL 76

Expert Comment

by:GrahamSkan
ID: 37721583
Try "#,##0". This will drop all leading zeros except the last one.
0
 

Author Comment

by:swpa_wnt
ID: 37721666
Hi, Graham,

Nope, no difference with that change.
0
 

Accepted Solution

by:
swpa_wnt earned 0 total points
ID: 37721668
I don't have leading zeros, I have leading spaces.

On edit: Ah, wait, here we go.  Instead of "##,###", I can delete the first two #s but leave the comma, so it is just ",###"  This will work for me, as none of the numbers are less than 3 digits.
0
 

Author Comment

by:swpa_wnt
ID: 37726905
Sorry, I guess my question turned into a non-issue after all. If you have no objection, Graham, I'll just delete it.
0
 

Author Closing Comment

by:swpa_wnt
ID: 37760255
I discovered a code format that worked for my purposes.
0

Featured Post

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

The Selection object is designed for user interaction. It has a Range property, so it can be used in most places that a Range object can. Recorded macros must use the Selection because they are simply copying what the user is doing. A Range prope…
Using Word 2013, I was experiencing some incredible lag when typing.  Here's what worked for me....
This video walks the viewer through the process of creating an MLA formatted document, as well as a bibliography with citations.
This Experts Exchange video Micro Tutorial shows how to tell Microsoft Office that a word is NOT spelled correctly. Microsoft Office has a built-in, main dictionary that is shared by Office apps, including Excel, Outlook, PowerPoint, and Word. When …

747 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now