Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Extra spaces in number in Word 2007 merge field

Posted on 2012-03-14
5
Medium Priority
?
374 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

[Webinar] Cloud Security

In this webinar you will learn:

-Why existing firewall and DMZ architectures are not suited for securing cloud applications
-How to make your enterprise “Cloud Ready”, and fix your aging DMZ architecture
-How to transform your enterprise and become a Cloud Enabler

Question has a verified solution.

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

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…
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 video shows where to find the word count, how to display it, and what it breaks down to in Microsoft Word.
Learn how to make your own table of contents in Microsoft Word using paragraph styles and the automatic table of contents tool. We'll be using the paragraph styles in Word’s Home toolbar to help you create a table of contents. Type out your initial …
Suggested Courses

916 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