View Single Post
 
Old 11-10-2015, 01:56 PM
macropod's Avatar
macropod macropod is offline Windows 7 64bit Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,963
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Unless you can be sure your field never contains a date later than the 28th of each month, you'll need to use something like the 'Calculate a day, date, month and year, using n months delay' example from my Microsoft Word Date Calculation Tutorial, at:
http://windowssecrets.com/forums/sho...ation-Tutorial
or:
http://www.gmayor.com/downloads.htm#Third_party
Do read the document's introductory material.

As coded, that example shows:
Code:
{QUOTE
{SET Delay 9}
{SET mm{=MOD(ABS({DATE \@ M}+Delay+11),12)+1}}
{SET yy{=INT({DATE \@ yyyy}+(Delay+{DATE \@ M}-1)/12)}}
{SET dd{=IF(({DATE \@ d}>28)*(mm=2)=1,28+((MOD(yy,4)=0)+(MOD(yy,400)=0)-(MOD(yy,100)=0)),IF((mm=4)+(mm=6)+(mm=9)+(mm=11)+({DATE \@ d}>30)>1,30,{DATE \@ d}))}}
"{dd}-{mm}-{yy}" \@ "dddd, d MMMM yyyy"}
You would need to change this to:
Code:
{QUOTE
{SET NoticeDate{MERGEFIELD Unit_Lease_Dates8}}
{SET Delay {MERGEFIELD Unit_Lease_Dates_Notice6}}
{SET mm{=MOD(ABS({NoticeDate \@ M}+Delay+11),12)+1}}
{SET yy{=INT({NoticeDate \@ yyyy}+(Delay+{DATE \@ M}-1)/12)}}
{SET dd{=IF(({NoticeDate \@ d}>28)*(mm=2)=1,28+((MOD(yy,4)=0)+(MOD(yy,400)=0)-(MOD(yy,100)=0)),IF((mm=4)+(mm=6)+(mm=9)+(mm=11)+({NoticeDate \@ d}>30)>1,30,{NoticeDate \@ d}))}}
"{dd}-{mm}-{yy}" \@ "dddd, d MMMM yyyy"}
It's also not clear whether you're adding or subtracting the 'Delay' value. If subtracting, use:
{SET Delay -{MERGEFIELD Unit_Lease_Dates_Notice6}}
making sure not to leave a space between '-' and {MERGEFIELD Unit_Lease_Dates_Notice6}.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote