Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #2  
Old 09-02-2020, 09:18 AM
eduzs eduzs is offline Field code for last day of the month Windows 10 Field code for last day of the month Office 2019
Expert
Field code for last day of the month
 
Join Date: May 2017
Posts: 266
eduzs is on a distinguished road
Default

For the 1st question, this seems to work (need to do more tests):

{QUOTE {SET Delay 0}{SET a{=INT((14-{DATE \@ M})/12)}}{SET b{={DATE \@ yyyy}+4800-a}}{SET c{={DATE \@ M}+12*a-3}}{SET d = 1 }{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}" \@ "d/M/yyyy"}

For the 2nd question, if I change "DATE" to "DOCVARIABLE mydate" it not work, cause in this situation the delay should be count from the 1st day of the next month before mydate, and not the 1st day of the current month.
__________________
Backup your original file before doing any modification.
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
Field code for last day of the month Word field last month not working within year change eduzs Word VBA 4 07-25-2019 04:31 PM
Field code for last day of the month VBA Code to search for field codes with certain text before the Field code and to change style welcometocandyland Word VBA 4 02-08-2017 06:53 PM
Word Field Code Displays Prior Month jadenmyboy Word 1 09-01-2015 12:29 PM
Formula to subtract one month from due date field in reminder field ghumdinger Outlook 1 10-01-2011 12:09 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 08:32 AM.


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