Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.word.docmanagement,microsoft.public.word.mailmerge.fields
|
|||
|
|||
![]()
This is slowly (nay quickly) driving me insane - I have an mailmerge IF
condition to help me spot pending appointments easily If { MERGEFIELD Myfield \@ "dd/MM/yyyy" } { DATE \@ "dd/MM/yyyy" } { MERGEFIELD Myfield \@ "ddd dd MMM hh:mm" } {MERGEFIELD Myfield \@ "dd/MM"} pseudo = If myfield is after today (pending) then, display mydate in long date format, else mydate as short date format e.g.: IF 31/10/2007 23/10/2007 = "Wed 31 Oct 07:00" = great IF 22/10/2007 23/10/2007 = "22/10" = great After a week of (seemingly) no problems - Today I uncovered a gremlin IF 06/11/2007 23/10/2007 is returning "06/11" ????? - that's True isn't it? I have always had problems getting MS Word (XP 2002) to interpret UK/English dates - I thought after DDE connection (albeit it very incovenient) my troubles were over Just looking at these examples myself (as i type here) I can see that despite 06/11/2007 displayed in full, formatted correctly (UK day/month), interpreted (from XL) & displayed correctly, connected as DDE - this is 'still' just a fudge for the folks over in blighty - it is clearly evident that MS Word 'still' thinks this is US 11th June 2007 & i am about to try few more dates to confirm it Is it fair to say MS Word just doesn't know what day it is? Or am I missing something obvious or do I give up gracefully? |
#2
![]()
Posted to microsoft.public.word.docmanagement,microsoft.public.word.mailmerge.fields
|
|||
|
|||
![]()
Hi Jethro,
What you're missing is that Word fields don't do date arithmetic. The results of the two internal fields beign compared here are _strings_ and the "greater than" comparison is doing an alphanumeric comparison of those strings. So whenever the day number of the merge field is less than the day number of today -- in your example, "06" is alphanumerically less than "23" -- the result of the comparison is False. It has nothing to do with US vs. UK or what Word "thinks" of the date. The only reliable way to express dates so they can be compared alphanumerically is with the format "yyyyMMdd", in decreasing unit order. Try rewriting the first part of your field as If { MERGEFIELD Myfield \@ "yyyyMMdd" } { DATE \@ "yyyyMMdd" } -- Regards, Jay Freedman Microsoft Word MVP FAQ: http://word.mvps.org Email cannot be acknowledged; please post all follow-ups to the newsgroup so all may benefit. JethroUK© wrote: This is slowly (nay quickly) driving me insane - I have an mailmerge IF condition to help me spot pending appointments easily If { MERGEFIELD Myfield \@ "dd/MM/yyyy" } { DATE \@ "dd/MM/yyyy" } { MERGEFIELD Myfield \@ "ddd dd MMM hh:mm" } {MERGEFIELD Myfield \@ "dd/MM"} pseudo = If myfield is after today (pending) then, display mydate in long date format, else mydate as short date format e.g.: IF 31/10/2007 23/10/2007 = "Wed 31 Oct 07:00" = great IF 22/10/2007 23/10/2007 = "22/10" = great After a week of (seemingly) no problems - Today I uncovered a gremlin IF 06/11/2007 23/10/2007 is returning "06/11" ????? - that's True isn't it? I have always had problems getting MS Word (XP 2002) to interpret UK/English dates - I thought after DDE connection (albeit it very incovenient) my troubles were over Just looking at these examples myself (as i type here) I can see that despite 06/11/2007 displayed in full, formatted correctly (UK day/month), interpreted (from XL) & displayed correctly, connected as DDE - this is 'still' just a fudge for the folks over in blighty - it is clearly evident that MS Word 'still' thinks this is US 11th June 2007 & i am about to try few more dates to confirm it Is it fair to say MS Word just doesn't know what day it is? Or am I missing something obvious or do I give up gracefully? |
#3
![]()
Posted to microsoft.public.word.docmanagement,microsoft.public.word.mailmerge.fields
|
|||
|
|||
![]()
Brilliant! - Oh what a clever chap you are - it makes so much sense too -
thanks thanks thanks I can now get on with the rest of my life - Thankyooooooooooooooooooo!!!!!!! "Jay Freedman" wrote in message ... Hi Jethro, What you're missing is that Word fields don't do date arithmetic. The results of the two internal fields beign compared here are _strings_ and the "greater than" comparison is doing an alphanumeric comparison of those strings. So whenever the day number of the merge field is less than the day number of today -- in your example, "06" is alphanumerically less than "23" -- the result of the comparison is False. It has nothing to do with US vs. UK or what Word "thinks" of the date. The only reliable way to express dates so they can be compared alphanumerically is with the format "yyyyMMdd", in decreasing unit order. Try rewriting the first part of your field as If { MERGEFIELD Myfield \@ "yyyyMMdd" } { DATE \@ "yyyyMMdd" } -- Regards, Jay Freedman Microsoft Word MVP FAQ: http://word.mvps.org Email cannot be acknowledged; please post all follow-ups to the newsgroup so all may benefit. JethroUK© wrote: This is slowly (nay quickly) driving me insane - I have an mailmerge IF condition to help me spot pending appointments easily If { MERGEFIELD Myfield \@ "dd/MM/yyyy" } { DATE \@ "dd/MM/yyyy" } { MERGEFIELD Myfield \@ "ddd dd MMM hh:mm" } {MERGEFIELD Myfield \@ "dd/MM"} pseudo = If myfield is after today (pending) then, display mydate in long date format, else mydate as short date format e.g.: IF 31/10/2007 23/10/2007 = "Wed 31 Oct 07:00" = great IF 22/10/2007 23/10/2007 = "22/10" = great After a week of (seemingly) no problems - Today I uncovered a gremlin IF 06/11/2007 23/10/2007 is returning "06/11" ????? - that's True isn't it? I have always had problems getting MS Word (XP 2002) to interpret UK/English dates - I thought after DDE connection (albeit it very incovenient) my troubles were over Just looking at these examples myself (as i type here) I can see that despite 06/11/2007 displayed in full, formatted correctly (UK day/month), interpreted (from XL) & displayed correctly, connected as DDE - this is 'still' just a fudge for the folks over in blighty - it is clearly evident that MS Word 'still' thinks this is US 11th June 2007 & i am about to try few more dates to confirm it Is it fair to say MS Word just doesn't know what day it is? Or am I missing something obvious or do I give up gracefully? |
#4
![]()
Posted to microsoft.public.word.docmanagement,microsoft.public.word.mailmerge.fields
|
|||
|
|||
![]()
Hi Jethro
Just in case you need to do anything more esoteric with dates in Word, check out my Date Calc 'tutorial', at: http://www.wopr.com/cgi-bin/w3t/show...?Number=249902 or http://www.gmayor.com/downloads.htm#Third_party Cheers -- macropod [MVP - Microsoft Word] ------------------------- "JethroUK©" wrote in message ... Brilliant! - Oh what a clever chap you are - it makes so much sense too - thanks thanks thanks I can now get on with the rest of my life - Thankyooooooooooooooooooo!!!!!!! "Jay Freedman" wrote in message ... Hi Jethro, What you're missing is that Word fields don't do date arithmetic. The results of the two internal fields beign compared here are _strings_ and the "greater than" comparison is doing an alphanumeric comparison of those strings. So whenever the day number of the merge field is less than the day number of today -- in your example, "06" is alphanumerically less than "23" -- the result of the comparison is False. It has nothing to do with US vs. UK or what Word "thinks" of the date. The only reliable way to express dates so they can be compared alphanumerically is with the format "yyyyMMdd", in decreasing unit order. Try rewriting the first part of your field as If { MERGEFIELD Myfield \@ "yyyyMMdd" } { DATE \@ "yyyyMMdd" } -- Regards, Jay Freedman Microsoft Word MVP FAQ: http://word.mvps.org Email cannot be acknowledged; please post all follow-ups to the newsgroup so all may benefit. JethroUK© wrote: This is slowly (nay quickly) driving me insane - I have an mailmerge IF condition to help me spot pending appointments easily If { MERGEFIELD Myfield \@ "dd/MM/yyyy" } { DATE \@ "dd/MM/yyyy" } { MERGEFIELD Myfield \@ "ddd dd MMM hh:mm" } {MERGEFIELD Myfield \@ "dd/MM"} pseudo = If myfield is after today (pending) then, display mydate in long date format, else mydate as short date format e.g.: IF 31/10/2007 23/10/2007 = "Wed 31 Oct 07:00" = great IF 22/10/2007 23/10/2007 = "22/10" = great After a week of (seemingly) no problems - Today I uncovered a gremlin IF 06/11/2007 23/10/2007 is returning "06/11" ????? - that's True isn't it? I have always had problems getting MS Word (XP 2002) to interpret UK/English dates - I thought after DDE connection (albeit it very incovenient) my troubles were over Just looking at these examples myself (as i type here) I can see that despite 06/11/2007 displayed in full, formatted correctly (UK day/month), interpreted (from XL) & displayed correctly, connected as DDE - this is 'still' just a fudge for the folks over in blighty - it is clearly evident that MS Word 'still' thinks this is US 11th June 2007 & i am about to try few more dates to confirm it Is it fair to say MS Word just doesn't know what day it is? Or am I missing something obvious or do I give up gracefully? |
#5
![]()
Posted to microsoft.public.word.docmanagement,microsoft.public.word.mailmerge.fields
|
|||
|
|||
![]()
In early help with this very IF function, Peter, Graham & indeed yourself
posted this very same date syntax for comparison, but for some reason i was so tied into the function i completely failed to even notice the format or the significance of year/month/day - so for that i extend my thanks & i'll check out the articles "macropod" wrote in message ... Hi Jethro Just in case you need to do anything more esoteric with dates in Word, check out my Date Calc 'tutorial', at: http://www.wopr.com/cgi-bin/w3t/show...?Number=249902 or http://www.gmayor.com/downloads.htm#Third_party Cheers -- macropod [MVP - Microsoft Word] ------------------------- "JethroUK©" wrote in message ... Brilliant! - Oh what a clever chap you are - it makes so much sense too - thanks thanks thanks I can now get on with the rest of my life - Thankyooooooooooooooooooo!!!!!!! "Jay Freedman" wrote in message ... Hi Jethro, What you're missing is that Word fields don't do date arithmetic. The results of the two internal fields beign compared here are _strings_ and the "greater than" comparison is doing an alphanumeric comparison of those strings. So whenever the day number of the merge field is less than the day number of today -- in your example, "06" is alphanumerically less than "23" -- the result of the comparison is False. It has nothing to do with US vs. UK or what Word "thinks" of the date. The only reliable way to express dates so they can be compared alphanumerically is with the format "yyyyMMdd", in decreasing unit order. Try rewriting the first part of your field as If { MERGEFIELD Myfield \@ "yyyyMMdd" } { DATE \@ "yyyyMMdd" } -- Regards, Jay Freedman Microsoft Word MVP FAQ: http://word.mvps.org Email cannot be acknowledged; please post all follow-ups to the newsgroup so all may benefit. JethroUK© wrote: This is slowly (nay quickly) driving me insane - I have an mailmerge IF condition to help me spot pending appointments easily If { MERGEFIELD Myfield \@ "dd/MM/yyyy" } { DATE \@ "dd/MM/yyyy" } { MERGEFIELD Myfield \@ "ddd dd MMM hh:mm" } {MERGEFIELD Myfield \@ "dd/MM"} pseudo = If myfield is after today (pending) then, display mydate in long date format, else mydate as short date format e.g.: IF 31/10/2007 23/10/2007 = "Wed 31 Oct 07:00" = great IF 22/10/2007 23/10/2007 = "22/10" = great After a week of (seemingly) no problems - Today I uncovered a gremlin IF 06/11/2007 23/10/2007 is returning "06/11" ????? - that's True isn't it? I have always had problems getting MS Word (XP 2002) to interpret UK/English dates - I thought after DDE connection (albeit it very incovenient) my troubles were over Just looking at these examples myself (as i type here) I can see that despite 06/11/2007 displayed in full, formatted correctly (UK day/month), interpreted (from XL) & displayed correctly, connected as DDE - this is 'still' just a fudge for the folks over in blighty - it is clearly evident that MS Word 'still' thinks this is US 11th June 2007 & i am about to try few more dates to confirm it Is it fair to say MS Word just doesn't know what day it is? Or am I missing something obvious or do I give up gracefully? |
Reply |
Thread Tools | |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
IF 06/11/2007 23/10/2007 = is "True" isn't it? | Microsoft Word Help | |||
Word 2007: "Keep with next" and "Widow Lines" features not workin | Microsoft Word Help | |||
Word 2007 view defaults to "Thumbnails" rather than "Document Map" | Microsoft Word Help | |||
Word 2007 and Powerpoint 2007 "close window" button | Microsoft Word Help | |||
How do I convert all "NAME" to "Name" in MS Word 2007 document? | Microsoft Word Help |