Home |
Search |
Today's Posts |
#1
|
|||
|
|||
In Word, any way to add 120 days to a merged date?
I'm trying display a date with 120 days added to it. The date is merged into
the document. The following formula {=DateAdd("d",120,{ MERGEFIELD "ODP_DATE" } ) } simply displays the formula as a text literal with the merged date whether or not contained in a 1x1 table. The document reads something like this: You have 120 days from {MERGEFIELD ODP_DATE} to return service. The new date is {=DateAdd("d",120,{ MERGEFIELD "ODP_DATE" })}. |
#2
|
|||
|
|||
See the reference documents referred to at
http://addbalance.com/word/datefields2.htm -- Charles Kenyon Word New User FAQ & Web Directory: http://addbalance.com/word Intermediate User's Guide to Microsoft Word (supplemented version of Microsoft's Legal Users' Guide) http://addbalance.com/usersguide See also the MVP FAQ: http://www.mvps.org/word which is awesome! --------- --------- --------- --------- --------- --------- This message is posted to a newsgroup. Please post replies and questions to the newsgroup so that others can learn from my ignorance and your wisdom. "UsedBits" wrote in message ... I'm trying display a date with 120 days added to it. The date is merged into the document. The following formula {=DateAdd("d",120,{ MERGEFIELD "ODP_DATE" } ) } simply displays the formula as a text literal with the merged date whether or not contained in a 1x1 table. The document reads something like this: You have 120 days from {MERGEFIELD ODP_DATE} to return service. The new date is {=DateAdd("d",120,{ MERGEFIELD "ODP_DATE" })}. |
#3
|
|||
|
|||
Hi UsedBits,
I don't understand how you got "Thursday, the 16rd of December, 2004" - the same field returns "Thursday, the 16th of December, 2004" for me, with superscripting. Cheers "UsedBits" wrote in message ... Charles & MacroPod, All I can say is "Wow!" Thanks! I first saw this kind of date arithmetic way back in the early eighties when working on the lowly IBM system/34 RPG-based system. We had a bunch of this stuff for doing date arithmetic, including leap year. However, not only did I not know in Word how to 'parse the dates' as you have shown, I had completely forgotten about all that stuff. Oh - there is an error in the WOPR document. It incorrectly displays the superscripted date (Insert A Date with Text using a Form Field). December 16, 2004 displays as "Thursday, the 16rd of December, 2004". The 'rd' is not superscripted. Again, this is an amazing piece of work. It has opened a whole new world! Regards, UsedBits "UsedBits" wrote: I'm trying display a date with 120 days added to it. The date is merged into the document. The following formula {=DateAdd("d",120,{ MERGEFIELD "ODP_DATE" } ) } simply displays the formula as a text literal with the merged date whether or not contained in a 1x1 table. The document reads something like this: You have 120 days from {MERGEFIELD ODP_DATE} to return service. The new date is {=DateAdd("d",120,{ MERGEFIELD "ODP_DATE" })}. |
#4
|
|||
|
|||
Hi UsedBits,
For a 'tutorial' with examples of how you can do this and much more than you ever thought you might want to with dates and times, all using Word fields, download the Word document at: http://www.wopr.com/cgi-bin/w3t/show...?Number=249902 (url all one line) Cheers "UsedBits" wrote in message ... I'm trying display a date with 120 days added to it. The date is merged into the document. The following formula {=DateAdd("d",120,{ MERGEFIELD "ODP_DATE" } ) } simply displays the formula as a text literal with the merged date whether or not contained in a 1x1 table. The document reads something like this: You have 120 days from {MERGEFIELD ODP_DATE} to return service. The new date is {=DateAdd("d",120,{ MERGEFIELD "ODP_DATE" })}. |
#5
|
|||
|
|||
Hi UsedBits,
The 'Insert A Date with Text using a Form Field' formula has nothing that relies on European vs US date formats. So, unless you edited it (eg changing the formula), it should work correctly regardless of your regional settings. Cheers "UsedBits" wrote in message ... Macropod, I had to convert the formulas for American date format (MMM/DD/YYYY) to get the date arithmetic to display as intended (per original question regarding adding 120 days to a merged date). Could it be that the superscripting is suffering the same fate, i.e., expecting European be receiving American formatted dates? At any rate, your work with the code fields is amazing. Thanks, very much for providing it in a public forum. Regards, UsedBits "macropod" wrote: Hi UsedBits, I don't understand how you got "Thursday, the 16rd of December, 2004" - the same field returns "Thursday, the 16th of December, 2004" for me, with superscripting. Cheers "UsedBits" wrote in message ... Charles & MacroPod, All I can say is "Wow!" Thanks! I first saw this kind of date arithmetic way back in the early eighties when working on the lowly IBM system/34 RPG-based system. We had a bunch of this stuff for doing date arithmetic, including leap year. However, not only did I not know in Word how to 'parse the dates' as you have shown, I had completely forgotten about all that stuff. Oh - there is an error in the WOPR document. It incorrectly displays the superscripted date (Insert A Date with Text using a Form Field). December 16, 2004 displays as "Thursday, the 16rd of December, 2004". The 'rd' is not superscripted. Again, this is an amazing piece of work. It has opened a whole new world! Regards, UsedBits "UsedBits" wrote: I'm trying display a date with 120 days added to it. The date is merged into the document. The following formula {=DateAdd("d",120,{ MERGEFIELD "ODP_DATE" } ) } simply displays the formula as a text literal with the merged date whether or not contained in a 1x1 table. The document reads something like this: You have 120 days from {MERGEFIELD ODP_DATE} to return service. The new date is {=DateAdd("d",120,{ MERGEFIELD "ODP_DATE" })}. |
#6
|
|||
|
|||
Charles & MacroPod,
All I can say is "Wow!" Thanks! I first saw this kind of date arithmetic way back in the early eighties when working on the lowly IBM system/34 RPG-based system. We had a bunch of this stuff for doing date arithmetic, including leap year. However, not only did I not know in Word how to 'parse the dates' as you have shown, I had completely forgotten about all that stuff. Oh - there is an error in the WOPR document. It incorrectly displays the superscripted date (Insert A Date with Text using a Form Field). December 16, 2004 displays as "Thursday, the 16rd of December, 2004". The 'rd' is not superscripted. Again, this is an amazing piece of work. It has opened a whole new world! Regards, UsedBits "UsedBits" wrote: I'm trying display a date with 120 days added to it. The date is merged into the document. The following formula {=DateAdd("d",120,{ MERGEFIELD "ODP_DATE" } ) } simply displays the formula as a text literal with the merged date whether or not contained in a 1x1 table. The document reads something like this: You have 120 days from {MERGEFIELD ODP_DATE} to return service. The new date is {=DateAdd("d",120,{ MERGEFIELD "ODP_DATE" })}. |
#7
|
|||
|
|||
Hi UsedBits,
Glad to be of help, though I still don't understand what's causing the problem you're having with the superscripting example in 'Insert A Date with Text using a Form Field' - I can't replicate it. Cheers "UsedBits" wrote in message ... Macropod, Copying/Pasting the superscript example into my document template and running a merge yields the following: Friday the 17th of December, 2004 (the 'th' is not superscripted) Opening the DateCalc 2_41.doc (without running a merge) yields the following: The following field expresses today in ordinal form, coupled with the day of the week: Friday the 17th of December, 2004 ('th' not superscripted, as expected) or Friday the 17rd of December, 2004 ('rd' not expected nor is it superscripted) As a programmer, I thought the unexpected outcome should be reported. Clearly there is something different with opening the .dot and using the ..dot to create a .doc in a merge. The code you've provided is of tremendous value. Thank you very, very much for having provided it and for taking the time to respond to my report. You have opened a whole new set of possibilities for us. "macropod" wrote: Hi UsedBits, The 'Insert A Date with Text using a Form Field' formula has nothing that relies on European vs US date formats. So, unless you edited it (eg changing the formula), it should work correctly regardless of your regional settings. Cheers "UsedBits" wrote in message ... Macropod, I had to convert the formulas for American date format (MMM/DD/YYYY) to get the date arithmetic to display as intended (per original question regarding adding 120 days to a merged date). Could it be that the superscripting is suffering the same fate, i.e., expecting European be receiving American formatted dates? At any rate, your work with the code fields is amazing. Thanks, very much for providing it in a public forum. Regards, UsedBits "macropod" wrote: Hi UsedBits, I don't understand how you got "Thursday, the 16rd of December, 2004" - the same field returns "Thursday, the 16th of December, 2004" for me, with superscripting. Cheers "UsedBits" wrote in message ... Charles & MacroPod, All I can say is "Wow!" Thanks! I first saw this kind of date arithmetic way back in the early eighties when working on the lowly IBM system/34 RPG-based system. We had a bunch of this stuff for doing date arithmetic, including leap year. However, not only did I not know in Word how to 'parse the dates' as you have shown, I had completely forgotten about all that stuff. Oh - there is an error in the WOPR document. It incorrectly displays the superscripted date (Insert A Date with Text using a Form Field). December 16, 2004 displays as "Thursday, the 16rd of December, 2004". The 'rd' is not superscripted. Again, this is an amazing piece of work. It has opened a whole new world! Regards, UsedBits "UsedBits" wrote: I'm trying display a date with 120 days added to it. The date is merged into the document. The following formula {=DateAdd("d",120,{ MERGEFIELD "ODP_DATE" } ) } simply displays the formula as a text literal with the merged date whether or not contained in a 1x1 table. The document reads something like this: You have 120 days from {MERGEFIELD ODP_DATE} to return service. The new date is {=DateAdd("d",120,{ MERGEFIELD "ODP_DATE" })}. |
#8
|
|||
|
|||
Macropod,
I had to convert the formulas for American date format (MMM/DD/YYYY) to get the date arithmetic to display as intended (per original question regarding adding 120 days to a merged date). Could it be that the superscripting is suffering the same fate, i.e., expecting European be receiving American formatted dates? At any rate, your work with the code fields is amazing. Thanks, very much for providing it in a public forum. Regards, UsedBits "macropod" wrote: Hi UsedBits, I don't understand how you got "Thursday, the 16rd of December, 2004" - the same field returns "Thursday, the 16th of December, 2004" for me, with superscripting. Cheers "UsedBits" wrote in message ... Charles & MacroPod, All I can say is "Wow!" Thanks! I first saw this kind of date arithmetic way back in the early eighties when working on the lowly IBM system/34 RPG-based system. We had a bunch of this stuff for doing date arithmetic, including leap year. However, not only did I not know in Word how to 'parse the dates' as you have shown, I had completely forgotten about all that stuff. Oh - there is an error in the WOPR document. It incorrectly displays the superscripted date (Insert A Date with Text using a Form Field). December 16, 2004 displays as "Thursday, the 16rd of December, 2004". The 'rd' is not superscripted. Again, this is an amazing piece of work. It has opened a whole new world! Regards, UsedBits "UsedBits" wrote: I'm trying display a date with 120 days added to it. The date is merged into the document. The following formula {=DateAdd("d",120,{ MERGEFIELD "ODP_DATE" } ) } simply displays the formula as a text literal with the merged date whether or not contained in a 1x1 table. The document reads something like this: You have 120 days from {MERGEFIELD ODP_DATE} to return service. The new date is {=DateAdd("d",120,{ MERGEFIELD "ODP_DATE" })}. |
#9
|
|||
|
|||
Macropod,
Copying/Pasting the superscript example into my document template and running a merge yields the following: Friday the 17th of December, 2004 (the 'th' is not superscripted) Opening the DateCalc 2_41.doc (without running a merge) yields the following: The following field expresses today in ordinal form, coupled with the day of the week: Friday the 17th of December, 2004 ('th' not superscripted, as expected) or Friday the 17rd of December, 2004 ('rd' not expected nor is it superscripted) As a programmer, I thought the unexpected outcome should be reported. Clearly there is something different with opening the .dot and using the .dot to create a .doc in a merge. The code you've provided is of tremendous value. Thank you very, very much for having provided it and for taking the time to respond to my report. You have opened a whole new set of possibilities for us. "macropod" wrote: Hi UsedBits, The 'Insert A Date with Text using a Form Field' formula has nothing that relies on European vs US date formats. So, unless you edited it (eg changing the formula), it should work correctly regardless of your regional settings. Cheers "UsedBits" wrote in message ... Macropod, I had to convert the formulas for American date format (MMM/DD/YYYY) to get the date arithmetic to display as intended (per original question regarding adding 120 days to a merged date). Could it be that the superscripting is suffering the same fate, i.e., expecting European be receiving American formatted dates? At any rate, your work with the code fields is amazing. Thanks, very much for providing it in a public forum. Regards, UsedBits "macropod" wrote: Hi UsedBits, I don't understand how you got "Thursday, the 16rd of December, 2004" - the same field returns "Thursday, the 16th of December, 2004" for me, with superscripting. Cheers "UsedBits" wrote in message ... Charles & MacroPod, All I can say is "Wow!" Thanks! I first saw this kind of date arithmetic way back in the early eighties when working on the lowly IBM system/34 RPG-based system. We had a bunch of this stuff for doing date arithmetic, including leap year. However, not only did I not know in Word how to 'parse the dates' as you have shown, I had completely forgotten about all that stuff. Oh - there is an error in the WOPR document. It incorrectly displays the superscripted date (Insert A Date with Text using a Form Field). December 16, 2004 displays as "Thursday, the 16rd of December, 2004". The 'rd' is not superscripted. Again, this is an amazing piece of work. It has opened a whole new world! Regards, UsedBits "UsedBits" wrote: I'm trying display a date with 120 days added to it. The date is merged into the document. The following formula {=DateAdd("d",120,{ MERGEFIELD "ODP_DATE" } ) } simply displays the formula as a text literal with the merged date whether or not contained in a 1x1 table. The document reads something like this: You have 120 days from {MERGEFIELD ODP_DATE} to return service. The new date is {=DateAdd("d",120,{ MERGEFIELD "ODP_DATE" })}. |
Reply |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
word xp crashes after macros are recorded | Microsoft Word Help | |||
WordPerfect - copying formatting | Page Layout | |||
WP Delay Code - Word Equiv | Microsoft Word Help | |||
Continuous breaks convert to next page breaks | Microsoft Word Help | |||
macro in word | Microsoft Word Help |