Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.word.mailmerge.fields
|
|||
|
|||
![]()
I have sent a mail just now.
"Peter Jamieson" wrote: If you despam my email pjj at-sign pjjnet dot demon dot co dot uk and email me I can send you what I have (I won't be around for a couple of days so now would be a good time!) Peter Jamieson http://tips.pjmsn.me.uk On 04/12/2009 20:27, SRV wrote: Peter, I tried to apply the given solution into my template but did not get any output. I haved added 2 closing braces that were missing before trying. If I am not asking too much, can you please provide me the compiled code that I can use without changes. I spent a day to get this working with my poor knowledge of template code and is in vain. Thank you so much for all your help. "Peter Jamieson" wrote: There are basically two ways to do it: a. if your data source allows it, write a function (e.g. in a query) that returns the number with all the formatting characters you want b. Do it by splitting the number into triplets. For numbers into the billions I think the following will do it. It's a first attempt, so I expect there are ways to simplify and/or shorten the code. (AFAICS Graham's approach also needs a bit of extra work to deal with the situation where you have (say) 1.000,01, and ensure that you output 000 rather than just 0 after the ".") { SET ts "." }{ SET dp "," }{ SET n { MERGEFIELD thenumber } }{ IF { =SIGN(n) } = -1 "-{ SET n { =abs(n) }{ SET z "0" }{ SET b { =int(n/1000000000) } }{ IF b 0 "{ b }{ ts }{ SET n { =n-(b*1000000000) } }{ SET z "000" }" }{ SET m { =int(n/1000000) } }{ IF m 0 "{ m \#{ z } }{ ts }{ SET n { =n-(m*1000000) } }{ SET z "000" }" "{ IF "{ z }" = "000" "000{ ts }" }{ SET t { =int(n/1000) } }{ IF t 0 "{ t \#{ z } }{ ts }{ SET n { =n-(t*1000) } }{ SET z "000" }" "{ IF "{ z }" = "000" "000{ ts }" }{ SET u { =int(n) } }{ IF u= 0 "{ u \#{ z } }" }{ SET n { =n-(u*100) } } }{ IF n 0 "{ dp }{ n \#00 }" "{ dp }00" } Apologies if I have transcribed that incorrectly. You can put { SET ts "." }{ SET dp "," } at the beginning of the document as they set up constants. I have done the last line the way it is so that you can choose for example whether to output ",00" or not. Peter Jamieson http://tips.pjmsn.me.uk On 03/12/2009 14:19, SRV wrote: Thank you for the reply. This soultion will not work for me as client did not accept this as a solution. Any other thoughts would really help us. "Doug Robbins - Word MVP" wrote: Change the formatting in the control panel before executing the merge. -- Hope this helps, Doug Robbins - Word MVP Please reply only to the newsgroups unless you wish to obtain my services on a paid professional basis. wrote in message ... I have a mail merge which has numbers (amounts) to be formatted for european regional settings ( comma as decimal seperator and dot as grouping seperator). I tried the following but it did not work. { MERGEFIELD "Net_Amount" \# #.###,00 } Using MS Office 2000 on Windows XP Appreciate you quick reply . . |
Reply |
Thread Tools | |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
How to make table of contents for different regional settings? | Microsoft Word Help | |||
regional settings affect calculation fields | Microsoft Word Help | |||
European union standards symbols | Microsoft Word Help | |||
Word 2003 in a WTS environment - regional information. | Microsoft Word Help | |||
European A4 paper? | Page Layout |