I am trying to display WWYY in word using the excel formula TEXT(WEEKNUM(TODAY()),"00")&TEXT(TODAY(),"YY")
The purpose of the document is to display the week and year when the document was opened. Let's say the document was opened today. it should display 0823.
Basically, if I go to Insert -> Date & Time , I would like to see a custom date field there as WWYY.
I tried creating the formula in excel and linking to word, but it's not working. I would like to implement this only in word for convenience.
Assuming you have text as "WWYY" in your word document, the approach I mention would at least replace "WWYY" with the format you want.
You have to save the document as a Word Macro-Enabled Document (.docm). Open up Microsoft Visual Basic Editor using the shortcut
Alt+F11orOption+fn+F11(macOS). Click onThisDocumenton the Project Toolbar on left. The Code editor forThisDocumentwill open up. Now you can use similar code as below to replace Instances ofWWYYwith the value populated. For today's dateWWYYwill now be replaced with0823. I have also written another function that will revert the value(i.e.0823) withWWYYwhen the file closes. That way when the file is opened in a different time, the functionality would still work.Beware! It will replace all the instances of
WWYYor0823. So a better idea is to use a prefix toWWYY. In document you'd havePrefix WWYYand also corresponding prefix in both RevertWWYY and ReplaceWWYY functions. (.Text = "Prefix WWYY"in ReplaceWWYY and in RevertWWYY.Text = "Prefix " + CStr(Forma...and.Replacement.Text = "Prefix WWYY").