Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 08-08-2018, 10:20 PM
Zhibek Zhibek is offline changing only year component in a date field using vba Windows 10 changing only year component in a date field using vba Office 2013
Advanced Beginner
changing only year component in a date field using vba
 
Join Date: Aug 2018
Location: Almaty, Kazakhstan
Posts: 30
Zhibek is on a distinguished road
Default changing only year component in a date field using vba

Please can you help me to run macros which shows a constant date in the document property which must changing only year component in future.
for example today is 03/31/2018 after one year it must be 03/31/2019

Thank you in advance!
Reply With Quote
  #2  
Old 08-08-2018, 10:57 PM
gmayor's Avatar
gmayor gmayor is offline changing only year component in a date field using vba Windows 10 changing only year component in a date field using vba Office 2016
Expert
 
Join Date: Aug 2014
Posts: 4,106
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 of
Default

Which 'document property' did you have in mind?
Your message subject says 'date field'. If you want to insert a date field, you don't need a macro you simply insert a date field with a formatting switch to dsiplay only the year e.g. { DATE \@ "yyyy" } - use CTRL+F9 for the field brackets. The rest is just text thus
3/31/{ DATE \@ "yyyy" }
will always show the last day of March in the current year.
__________________
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
  #3  
Old 08-08-2018, 11:43 PM
Zhibek Zhibek is offline changing only year component in a date field using vba Windows 10 changing only year component in a date field using vba Office 2013
Advanced Beginner
changing only year component in a date field using vba
 
Join Date: Aug 2018
Location: Almaty, Kazakhstan
Posts: 30
Zhibek is on a distinguished road
Default

Thank you a lot!!
Reply With Quote
  #4  
Old 08-16-2018, 12:03 AM
Zhibek Zhibek is offline changing only year component in a date field using vba Windows 10 changing only year component in a date field using vba Office 2013
Advanced Beginner
changing only year component in a date field using vba
 
Join Date: Aug 2018
Location: Almaty, Kazakhstan
Posts: 30
Zhibek is on a distinguished road
Default

Quote:
Originally Posted by gmayor View Post
Which 'document property' did you have in mind?
Your message subject says 'date field'. If you want to insert a date field, you don't need a macro you simply insert a date field with a formatting switch to dsiplay only the year e.g. { DATE \@ "yyyy" } - use CTRL+F9 for the field brackets. The rest is just text thus
3/31/{ DATE \@ "yyyy" }
will always show the last day of March in the current year.
Graham, hi!
3/31/{ DATE \@ "yyyy" }
here what should I add if I need always show the last day of March in the next year?
For example:
today is 16/8/2018
in document it must shows 3/31/2019

Thank you for help~!
Reply With Quote
  #5  
Old 08-16-2018, 01:05 AM
macropod's Avatar
macropod macropod is offline changing only year component in a date field using vba Windows 7 64bit changing only year component in a date field using vba 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

To see how to do this and just about everything else you might want to do with dates in Word, check out my Microsoft Word Date Calculation Tutorial, in the 'Sticky' thread at:
https://www.msofficeforums.com/word/...-tutorial.html
In particular, look at the item titled Calculate the day & date of the last or nth-to-last day of a given month. Do read the document's introductory material.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #6  
Old 08-16-2018, 01:29 AM
Zhibek Zhibek is offline changing only year component in a date field using vba Windows 10 changing only year component in a date field using vba Office 2013
Advanced Beginner
changing only year component in a date field using vba
 
Join Date: Aug 2018
Location: Almaty, Kazakhstan
Posts: 30
Zhibek is on a distinguished road
Thumbs up

Quote:
Originally Posted by macropod View Post
To see how to do this and just about everything else you might want to do with dates in Word, check out my Microsoft Word Date Calculation Tutorial, in the 'Sticky' thread at:
https://www.msofficeforums.com/word/...-tutorial.html
In particular, look at the item titled Calculate the day & date of the last or nth-to-last day of a given month. Do read the document's introductory material.
Hi, Paul

It is GREAT. Thank you a lot!

Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
changing only year component in a date field using vba Trying to generate a Documents with the date for every day of the year. RLAlura Mail Merge 2 01-28-2016 02:57 PM
How to calculate a rolling year-to-date percentage by quarter as the year progresses sleake Excel Programming 2 04-23-2015 11:51 AM
changing only year component in a date field using vba How to insert a year-only SaveDate field David Ziegler Word 2 04-10-2014 07:38 PM
Date field inserting merge date in blank field Lesley Mail Merge 5 09-30-2013 01:49 AM
changing only year component in a date field using vba changing date format in Bibliography field elly111sk Word 3 07-25-2012 06:54 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 08:44 PM.


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