Written by Allen Wyatt (last updated December 9, 2023)
This tip applies to Word 2007, 2010, 2013, 2016, 2019, 2021, and Word in Microsoft 365
Kristen has a document that uses fields extensively. A lot (but not all) of those fields are DATE fields. She can convert each field to text manually using Ctrl+Shift+F9, but she would like a way to convert all of the DATE fields at once without disturbing the other fields.
The easiest way to do this is to use a macro. Fortunately, Word makes all the fields in a document available in the Fields collection, and you can use your macro to step through each of those. Here's an example:
Sub UnlinkDateFields() Dim aField As Field Dim lNum As Long lNum = 0 For Each aField In ActiveDocument.Fields If Left(Trim(aField.Code), 4) = "DATE" Then aField.Unlink lNum = lNum + 1 End If Next aField MsgBox lNum & " DATE fields converted to text" End Sub
Note that the .Code property of the field is examined, which is what you see when you look at the field code within your document. If the left four characters of the .Code property is equal to "DATE", then the .Unlink method is invoked, which converts the field to text. The macro keeps a count of how many fields were converted and then, when finished, displays a message box that shows the total.
WordTips is your source for cost-effective Microsoft Word training. (Microsoft Word is the most popular word processing software in the world.) This tip (6016) applies to Microsoft Word 2007, 2010, 2013, 2016, 2019, 2021, and Word in Microsoft 365.
The First and Last Word on Word! Bestselling For Dummies author Dan Gookin puts his usual fun and friendly candor back to work to show you how to navigate Word 2013. Spend more time working and less time trying to figure it all out! Check out Word 2013 For Dummies today!
If you use fields in your documents, you may want to highlight them in some way so that you can find them easier. Word ...
Discover MoreFields (sometimes called field codes) allow you to insert dynamic information in your documents. If you want to see the ...
Discover MoreThe TC field is normally used in constructing manual Tables of Contents. The way the field works, however, makes it a ...
Discover MoreFREE SERVICE: Get tips like this every week in WordTips, a free productivity newsletter. Enter your address and click "Subscribe."
2023-12-11 10:10:02
Andrew
Instead of -- Left(Trim(aField.Code), 4) = "DATE" --
why not check for -- aField.Type = wdFieldDate?
Got a version of Word that uses the ribbon interface (Word 2007 or later)? This site is for you! If you use an earlier version of Word, visit our WordTips site focusing on the menu interface.
Visit the WordTips channel on YouTube
FREE SERVICE: Get tips like this every week in WordTips, a free productivity newsletter. Enter your address and click "Subscribe."
Copyright © 2025 Sharon Parq Associates, Inc.
Comments