Hi charles
Great thanks for your response. It's hard enough to understand, but I will read out from the link

for more try.
Thanks
Charles
Quote:
Originally Posted by Charles Kenyon
See Calculated Dates in Microsoft Word using Fields or vba
Because of the ideosyncracies of the calendar, this is not simple. For the 24th to the 25th is simple. But because months can have different numbers of days and adding 1 to December 31 can push you into a different year, you don't end up just changing the day field.
A field for this looks something like { QUOTE "{ SET " Delay" "1" }
{ SET "DaysInMonth" { IF { CreateDate \@ "MM" } <> 2
{ = ROUND(30.575*{ CreateDate \@ "MM" },0)-
ROUND(30.575*{ = { CreateDate \@ "MM" } -1 },0) }
{ IF { = MOD( { CreateDate \@"yy" } , 4 ) } > 0 "28" "29" } } }
{ SET "NextMonth" { IF { CreateDate \@ "MM" } = 12 "1/97"
"{ = { CreateDate \@ "MM"} + 1 }/97 } }
{ IF { = { REF "Delay" } + { CreateDate \@ "dd" } } <= {REF"DaysInMonth"}
{CreateDate \@ "MMMM { = { REF "Delay" } + { CreateDate \@ "dd" } }, yyyy"}{ QUOTE { NextMonth \@ "MMMM" }
{ = { REF "Delay" } + { CreateDate \@ "dd" } - { REF"DaysInMonth" } },
{ IF { CreateDate \@ "MM" } <> 12 { CreateDate \@ "yyyy" }
{ CreateDate \@ "{ = 1 + { CreateDate \@ "yyyy" } \# "xxxx" }" } } } }" }
Downright scary!
You can use vba instead. See the links on the page above to go to Paul Edstein's date calculation page if you want to try that route instead.
|