View Single Post
  #5   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Graham Mayor Graham Mayor is offline
external usenet poster
 
Posts: 19,312
Default Remove the leading zero from mergefield .

Peter also suggested another method of dealing with long numbers some time
ago which appears at http://www.gmayor.com/formatting_word_fields.htm under
the heading 'Number fields'

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org


Peter Jamieson wrote:
Does Word have a limitation of 14 / 15 digits?


Yes.

Which version(s) of Word are you using?

What is the specific reason that you cannot remove the leading 0 in
the text file (which may be the best way to do this)? Is it because
you need to avoid creating new files in the local file system, or do
you just mean that you have no control over how the file is created
in the first place?
What is the exact format of the text file? Is it comma-delimited?
tab-delimited? Some other delimiter? And is the number enclosed in
quotes or not, e.g.

is it

k,num
1,"01234567890123456789"

k,num
1,01234567890123456789

or what?

Are all the numbers 20 digits long? Do you only ever need to strip a
single leading zero, or if there are more leading zeros, do you need
to strip them all?

If it's only one leading zero, would it be enough to overwrite the 0
by a white-coloured zero, e.g. using something like

{ MERGEFIELD num }{ ADVANCE \l 130 }0{ ADVANCE \r 140 }

(You would need to colour that "0" white, and adjust the two values
in the ADVANCE fields, but because digits are always fixed width this
should "work" as long as you can use ADVANCE to move exactly the
correct distance leftwards. Tacky, but it might be the simplest
approach)
Peter Jamieson

"Joergen Bondesen" wrote in message
...
Hi Dough

Your reply maked med happy, but a test in XP shows:

Input: 09812340078901230067
Output 9812340078901200000

The leading Zero is removed but trailing 230067 = 200000
Does Word have a limitation of 14 / 15 digits?

--
Best Regards
Joergen Bondesen


"Doug Robbins - Word MVP" wrote in message
...
Put the mergefield in a formula that mulitplies it by 1

{ = { MERGEFIELD fieldname } * 1 }

You must use Ctrl+F9 to insert the field delimiters { }

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of
my services on a paid consulting basis.

Doug Robbins - Word MVP

"Joergen Bondesen" wrote in message
...
Hi NG.

I have a mailmerge field where the field from a txt-file display 20
digits: '09812340078901230067'
I want only displayed 19 digits '9812340078901230067' because zero
may not be displayed.
It is not posssible to remove the leading zero in the txt-file.

-----
Best Regards from
Joergen Bondesen