Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 08-06-2021, 08:39 PM
gmayor's Avatar
gmayor gmayor is offline Please Help. Future date macro that updates automatically Windows 10 Please Help. Future date macro that updates automatically Office 2019
Expert
 
Join Date: Aug 2014
Posts: 4,144
gmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud of
Default

Did you even read the link I posted? Download the document I referred to and on page 7 you will see a heading 'Calculate a day, date, month and year, using n days delay'. Select the date in that section. Right click and 'toggle field codes'. Copy the code and paste to where you want the calculated date. Change the delay to 1 and the switch to "dd/MM/yyyy"

{QUOTE
{SET Delay 14}
{SET a{=INT((14-{DATE \@ M})/12)}}


{SET b{={DATE \@ yyyy}+4800-a}}
{SET c{={DATE \@ M}+12*a-3}}
{SET d{DATE \@ d}}
{SET jd{=d+INT((153*c+2)/5)+365*b+INT(b/4)-INT(b/100)+INT(b/400)-32045+Delay}}
{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"}
__________________
Graham Mayor - MS MVP (Word) (2002-2019)
Visit my web site for more programming tips and ready made processes www.gmayor.com
Reply With Quote
  #2  
Old 08-09-2021, 04:10 AM
MartyC MartyC is offline Please Help. Future date macro that updates automatically Windows 10 Please Help. Future date macro that updates automatically Office 2019
Novice
Please Help. Future date macro that updates automatically
 
Join Date: Aug 2021
Posts: 11
MartyC is on a distinguished road
Default

Sorry, I Did read and then downloaded the next document. Ill try this today.
Quote:
Originally Posted by gmayor View Post
Did you even read the link I posted? Download the document I referred to and on page 7 you will see a heading 'Calculate a day, date, month and year, using n days delay'. Select the date in that section. Right click and 'toggle field codes'. Copy the code and paste to where you want the calculated date. Change the delay to 1 and the switch to "dd/MM/yyyy"

{QUOTE
{SET Delay 14}
{SET a{=INT((14-{DATE \@ M})/12)}}
{SET b{={DATE \@ yyyy}+4800-a}}
{SET c{={DATE \@ M}+12*a-3}}
{SET d{DATE \@ d}}
{SET jd{=d+INT((153*c+2)/5)+365*b+INT(b/4)-INT(b/100)+INT(b/400)-32045+Delay}}
{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"}
Reply With Quote
  #3  
Old 08-09-2021, 05:21 AM
MartyC MartyC is offline Please Help. Future date macro that updates automatically Windows 10 Please Help. Future date macro that updates automatically Office 2019
Novice
Please Help. Future date macro that updates automatically
 
Join Date: Aug 2021
Posts: 11
MartyC is on a distinguished road
Default

Okay, I can only get the following message. I'm sure its something simple, but I really have no idea what I'm doing.

Error! Too many picture switches defined.

Here is what the code looks like to me. I'm sure you guys can spot the errors.

I do appreciate your time
Attached Images
File Type: gif Code.gif (53.3 KB, 28 views)
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Preceding Day on Future Date.. ThorstenG Project 0 12-18-2017 06:14 AM
Please Help. Future date macro that updates automatically Date field - future date calculation + only business days neon4 Word 7 01-21-2016 02:21 PM
Please Help. Future date macro that updates automatically macro to automatically date sheet tab Jackie Excel Programming 13 05-24-2015 02:36 PM
Please Help. Future date macro that updates automatically VBA code for inserting a future date cosmopolitan Word VBA 1 08-14-2013 01:58 PM
Please Help. Future date macro that updates automatically Automatic date updates. WLVanS Word 12 01-29-2011 04:01 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 02:53 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