Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 02-11-2022, 09:51 PM
gmayor's Avatar
gmayor gmayor is offline Insert field in formula with VBA Windows 10 Insert field in formula with VBA 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

Why not simply insert a DATE field (or a CREATEDATE field if it is a template)
{ DATE \@ "yyyy" } or { CREATEDATE \@ "yyyy" } ? This will always show the year (or in the case of the latter the year the document was created.



To insert a DocProperty field
Code:
Selection.Fields.Add Range:=Selection.Range, Type:=wdFieldDocProperty, Text:="Annee", PreserveFormatting:=False
__________________
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 02-14-2022, 01:24 AM
cc85 cc85 is offline Insert field in formula with VBA Windows 10 Insert field in formula with VBA Office 2013
Novice
Insert field in formula with VBA
 
Join Date: Feb 2022
Posts: 3
cc85 is on a distinguished road
Default

Thank you
But that's not what I want.
For example, I did an exercise in 2018. All the dates in that exercise are from 2016 to 2024.
I want to give this same exercise now: I need to change all the dates, from 2020 to 2028.
So, I need a formula...
I wish you a good day
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Insert field in formula with VBA Possible to use an existing vlookup formula to also insert correct info and trigger a SUM formula innkeeper9 Excel 2 09-13-2016 08:59 PM
Insert field in formula with VBA Insert a field CepheiMD Word 2 03-18-2016 01:56 AM
Insert field in formula with VBA insert database as field david_89_ Mail Merge 3 03-26-2014 06:02 AM
Formula Field using Field Codes hunter2193 Word 3 04-05-2013 04:58 AM
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 04:36 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