Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #2  
Old 08-11-2011, 05:14 AM
macropod's Avatar
macropod macropod is offline Using the Delay fields Windows 7 64bit Using the Delay fields Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,467
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

Hi Foxfire,

The best way to do this sort of thing is to modify the data source, so that it calculates the correct dates from the outset. That way, there's nothing left for the mailmerge to work out.

If that's not practical, you can adapt the tutorial example titled 'Calculate a lease expiry date, using n months delay', by adding a new line, thus:
{SET StartDate {MERGEFIELD "Tenant_Paid_To"}}
after the '{SET Delay 12}' line (modified to'{SET Delay 1}') and changing all the 'DATE' references to 'StartDate'.

You should end up with a field code that looks like:
{QUOTE
{SET Delay 1}
{SET StartDate {MERGEFIELD "Tenant_Paid_To"}}
{SET m{=MOD(ABS({StartDate \@ M}+Delay+11),12)+1}}
{SET y{=INT({StartDate \@ yyyy}+(Delay+{StartDate \@ M}-1)/12)}}
{SET a{=INT((14-m)/12)}}
{SET b{=y+4800-a}}
{SET c{=m+12*a-3}}
{SET d{=IF(({StartDate \@ d}>28+((MOD(yy,4)=0)+(MOD(yy,400)=0)-(MOD(yy,100)=0)))*(m=2)=1,29+((MOD(yy,4)=0)+(MOD(y y,400)=0)-(MOD(yy,100)=0)),{StartDate \@ d})}}
{SET jd{=d+INT((153*c+2)/5)+365*b+INT(b/4)-INT(b/100)+INT(b/400)-32045-1}}
{SET e{=INT((4*(jd+32044)+3)/146097)}}
{SET f{=jd+32044-INT(146097*e/4)}}
{SET g{=INT((4*f+3)/1461)}}
{SET h{=f-INT(1461*g/4)}}
{SET i{=INT((5*h+2)/153)}}
{SET dd{=h-INT((153*i+2)/5)+1}}
{SET mm{=i+3-12*INT(i/10)}}
{SET yy{=100*e+g-4800+INT(i/10)}}
"{dd}-{mm}-{yy}" \@ "dddd, d MMMM yyyy"}

Or you can copy/paste the above into your document and use the macro I developed at: http://www.gmayor.com/export_field.htm#TextToField to convert it to a working field code.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
delay sending email and follow up on all emails lefteris Outlook 1 05-17-2011 05:11 PM
Using the Delay fields Delay delivery Registrar Outlook 1 07-01-2010 10:17 AM
Using the Delay fields Delay/Pause animated photo prior to next clipart BettyC PowerPoint 2 04-19-2010 02:12 PM
Email send delay--where? markg2 Outlook 8 02-14-2010 03:40 PM
How to delay sending an invitation... imported_misterbobthetomato Outlook 0 07-20-2006 07:42 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 01:48 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft