Converting All DATE Fields to Text

Written by Allen Wyatt (last updated December 9, 2023)
This tip applies to Word 2007, 2010, 2013, 2016, 2019, Word in Microsoft 365, and 2021


1

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, Word in Microsoft 365, and 2021.

Author Bio

Allen Wyatt

With more than 50 non-fiction books and numerous magazine articles to his credit, Allen Wyatt is an internationally recognized author. He is president of Sharon Parq Associates, a computer and publishing services company. ...

MORE FROM ALLEN

Accessing Excel through a PDF File

Word and PDF files go together like peanut butter and jelly. (How's that for a metaphor?) If you create PDF files from ...

Discover More

Only Inline Figures Can be Seen and Printed

Insert a graphic into a document and you expect to be able to see it. What do you do if it isn't displayed, however? Here ...

Discover More

Invalid Names when Opening Workbook

Don't you hate opening a workbook and seeing error messages? If you see a message that some "invalid names" were detected ...

Discover More

Learning Made Easy! Quickly teach yourself how to format, publish, and share your content using Word 2013. With Step by Step, you set the pace, building and practicing the skills you need, just when you need them! Check out Microsoft Word 2013 Step by Step today!

More WordTips (ribbon)

Cross-Reference Removes Superscript Formatting

When you add a cross-reference to your document, it provides a way to dynamically reference text in another location, ...

Discover More

Calculating Page Count for a Range of Sections

When adding page numbers to a header or footer, you may find it helpful to modify how Word determines its "Page X of Y" ...

Discover More

Maintaining Fields in a Merged Document

When merging documents, you may want to include some fields in the merged documents. For some fields this is impossible, ...

Discover More
Subscribe

FREE SERVICE: Get tips like this every week in WordTips, a free productivity newsletter. Enter your address and click "Subscribe."

View most recent newsletter.

Comments

If you would like to add an image to your comment (not an avatar, but an image to help in making the point of your comment), include the characters [{fig}] (all 7 characters, in the sequence shown) in your comment text. You’ll be prompted to upload your image when you submit the comment. Maximum image size is 6Mpixels. Images larger than 600px wide or 1000px tall will be reduced. Up to three images may be included in a comment. All images are subject to review. Commenting privileges may be curtailed if inappropriate images are posted.

What is four less than 7?

2023-12-11 10:10:02

Andrew

Instead of -- Left(Trim(aField.Code), 4) = "DATE" --
why not check for -- aField.Type = wdFieldDate?


This Site

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.

Videos
Subscribe

FREE SERVICE: Get tips like this every week in WordTips, a free productivity newsletter. Enter your address and click "Subscribe."

(Your e-mail address is not shared with anyone, ever.)

View the most recent newsletter.