Dans son message, < David Shaw > rivait :
|| Hi, could someone help me with a fields issue have in Word please.
|| I have a document with formfields in, the document was created on a
Windows/Word XP computer set
|| to English(United Kingdom) and to use formatted numbering ie 1,000.00 for
|| If you change the computer you are working on to French(Belgium) (They
show a thousand seperator
|| as a full stop and a decimal as a comma, the exact opposite of the UK
setting ie 1.000,00 for
|| 1000) in the control panel, I would expect the fields to swap the comma
and the full stop the
|| same way Excel does so a thousand is still a thousand, it does not, in
this instance 1.00
|| becomes .10, calculating fields is completely out of the question as they
go wrong as well, does
|| anyone know why Excel can do it correctly but Word cannot and what Word
is trying to do to come
|| up with the figures it does.
|| It appears that the form fields retain the british formatting inside
themselves and get into a
|| complete mess when the currency symbols in system are different.
|| Any help with this would be greatly appreciated.
I have faced this many times here in Canada where we have the English/French
numbering styles. By the way, are you sure that Belgium uses 1.000,00 for a
thousand? Shouldn't it be 1 000.00? (With a space as a decimal separator?)
As far as I can tell, you have two options:
One that involves VBA and that would set the fields format based on the
local machine regional settings whenever a document is opened. Lots of
testing and it can get hairy if you are not all that familiar with VBA. I
have never done it mainly because none of my client were ever willing to pay
for the time it would take. So I assume it can be done... You would need
Dim myDecSep As Variant
Dim myThouSep As Variant
Dim myListSep As Variant
myDecSep = Application.International(wdDecimalSeparator)
myThouSep = Application.International(wdThousandsSeparator)
myListSep = Application.International(wdListSeparator)
and stuff like:
Dim myFormfield As FormField
Set myFormfield = ActiveDocument.Content.FormFields(1)
If .Type = wdFieldFormTextInput Then
.EditType Type:=wdNumberText, Default:="", Format:= _
' Here build the format string using the info from above, like:
' "#" & myThouSep & "##0"
' "#" & myThouSep & "##0" & myDecSep & "00 $"
' "0" & myDecSep & "00"
But you have to unlock the form, save the field value before changing the
format so that you can set it back to its original value and you have to
watch out for the list separator in other fields.
The other solution is to temporarily set your machine to the Belgium
regional settings and create a localize version of the form. The drawback
with this is that forms cannot be sent to computers with different regional
settings for editing.
Jean-Guy Marcil - Word MVP
Word MVP site: http://www.yqcomputer.com/