Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #2  
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
 

Thread Tools
Display Modes


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:51 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