Unlocking a Subset of Fields

Written by Allen Wyatt (last updated August 15, 2026)

1

Dennis's document has quite a few fields in it. Most of the time he keeps the fields locked so that they don't update. (There are enough fields that updating them all can cause a noticeable delay.) Dennis wonders if there is a way to select a subset of fields, such as DATE or REF, and unlock just that subset in one go?

Document fields can be either locked or unlocked. If they are unlocked, then they are updated as normal, providing the dynamic content that most people want. (When you insert a field, it is unlocked, by default.) If a field is locked, then it is not updated automatically and simply returns whatever results was visible when the field was last locked.

There is no built-in way to selectively unlock fields in a document. Microsoft expects that you will lock or unlock fields one by one, or by selecting all the fields and you want to affect and then changing their lock status.

Fortunately, you can create a macro to do the unlocking. The following macro asks the user for the type of field to be unlocked, and then steps through the fields in the document to make the changes:

Sub UnlockSpecificFields()
    Dim fld As Field
    Dim fldCode As String
    Dim fldType As String
    Dim requestedType As String
    Dim spacePos As Long
    Dim fieldCount As Long

    requestedType = InputBox( _
      "Enter the field type you want to unlock " & _
      "(for example, DATE, TIME, REF, or PAGE):", _
      "Field Type")

    requestedType = UCase(Trim(requestedType))

    If requestedType > "" Then
        fieldCount = 0

        For Each fld In ActiveDocument.Fields
            fldCode = UCase(Trim(fld.Code.Text))

            'Get only the field type, which is the first
            'word in the field code.
            spacePos = InStr(fldCode, " ")

            If spacePos > 0 Then
                fldType = Left(fldCode, spacePos - 1)
            Else
                fldType = fldCode
            End If

            If fldType = requestedType Then
                If fld.Locked Then
                    fld.Locked = False
                    fieldCount = fieldCount + 1
                End If
            End If
        Next fld

        MsgBox fieldCount & " " & requestedType & _
          " field" & IIf(fieldCount < 2, " was", "s were") & _
          " unlocked.", vbInformation, "Done"
    End If
End Sub

The heart of the macro is where the .Locked property is set to False, which unlocks a field. Everything else in the macro is used to determine which fields to unlock and to make the proper comparison to each field within the document. When the macro is complete, it reports on how many fields were unlocked.

Note, as well, that this macro affects only those fields within the main body of the document. If you have fields in other places (such as footnotes, endnotes, and the like), nothing is done with those.

Note:

If you would like to know how to use the macros described on this page (or on any other page on the WordTips sites), I've prepared a special page that includes helpful information. Click here to open that special page in a new browser tab.

WordTips is your source for cost-effective Microsoft Word training. (Microsoft Word is the most popular word processing software in the world.) This tip (13994) applies to Microsoft Word 2007, 2010, 2013, 2016, 2019, 2021, 2024, and Word in Microsoft 365.

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

Floating Footer

Need some specific text to appear just below the end of the text on the last page of your document? You can accomplish ...

Discover More

Columns within Text Boxes

Text boxes are a common design element for some documents. If you want a text box to contain multiple columns, you are ...

Discover More

Filling a Set Number of Cells

The fill capability of Excel is quite handy, allowing you to easily fill a range of cells based on the content in a ...

Discover More

Discover the Power of Microsoft Office This beginner-friendly guide reveals the expert tips and strategies you need to skyrocket your productivity and use Office 365 like a pro. Mastering software like Word, Excel, and PowerPoint is essential to be more efficient and advance your career. Simple lessons guide you through every step, providing the knowledge you need to get started. Check out Microsoft Office 365 For Beginners today!

More WordTips (ribbon)

Deleting All Fields

Fields can be a great way of adding small snippets of dynamic data to your documents. However, you may want to get rid of ...

Discover More

Using the GotoButton Field

Need to jump from one place in your document to another? One way to do this is through the user of the GotoButton field, ...

Discover More

Indicating the Date Changes were Last Made

Do you want to keep track of when changes were made to your document? This tip looks at a couple of ways to do it, along ...

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 5 + 5?

2026-08-15 13:28:09

Vince Lord

I guess once they are unlocked and you close the document, the next time you open them they are still open. Haven’t tried that, but seems like another micro to reset them upon closing the document would be needed. Or is there a quick way?


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.