View Single Post
 
Old 04-12-2010, 03:08 AM
michielvanderbiest michielvanderbiest is offline Windows 2K Office 2003
Novice
 
Join Date: Apr 2010
Posts: 2
michielvanderbiest is on a distinguished road
Default Mergefield date error

Hello,


I'm having a problem while using the Mergefield function in word. I need to fill in a couple of dates from an excelfile into word (Date1, Date2 and Date3). The format I want to use is dd/MM/yyyy, for all 3 dates. I have changed my language setting in the control panel to read 'English'.

This is how my excelfile looks like:


Product_______Date1________Date2_______Date3
STR_______02/04/2010____03/04/2010____23/04/2010
FWD______02/04/2010_____03/04/2010
STR_______02/04/2010____03/04/2010____09/04/2010

Then, my word file has to be filled in, based on the column 'Product' (there are 3 possibilities), e.g.:

Line1. {MERGEFIELD Date1 \@ "dd/MM/yyyy"}

Line2. {IF {MERGEFIELD Product} = "FWD" "{MERGEFIELD Date2\@ "dd/MM/yyyy"}" {IF{MERGEFIELD Product }= "STR" "{MERGEFIELD Date2\@ "dd/MM/yyyy"}"{IF{MERGEFIELD Product }= "SWF" "random text"}}}

Line3. {IF {MERGEFIELD Product} = "FWD" "random text" {IF{MERGEFIELD Product }= "STR" "{MERGEFIELD Date3\@ "dd/MM/yyyy"}"{IF{MERGEFIELD Product }= "SWF" "random text"}}}


Line 1 and 2 work like a charm. Line 3 is the problem. It works perfectly for Product 'FWD' and 'SWF', but Word inverts Date3 in some cases! When a day is less then 13, the date gets format MM/dd/yyyy instead of dd/MM/yyyy. It seems like Word checks if it is possible to switch the day and month. Values I get for Line3 in word for the different fields in excel:

-> 23/04/2010 (as it should be)
-> random text (okay as well)
-> 04/09/2010 (this should be 09/04/2010)

I have no idea why this happens, and why this only happens for Line3!?! Does anybody have a solution for this?

Thanks in advance!
Michiel
Reply With Quote