
Tips.Net > WordTips Home > Fields > Locating Locked Fields
Summary: A field can be locked or unlocked, and its condition controls whether it is updated automatically or not. If you want to search for only locked fields in a document, you’re going to need the macro presented in this tip. (This tip works with Microsoft Word 97, Word 2000, Word 2002, Word 2003, and Word 2007.)
Fields are very useful when working with a document—they allow you to place "dynamic" information in your documents. Sometimes you may want a field to remain static; to not change. You can do this by selecting the field and press Ctrl+F11. This "locks" the field so it does not update from its current value.
If you have a lot of fields in a document, and some of them are locked, you may want a way to quickly find out which ones are locked. Word has no special feature that allows you to search for locked fields, but you can create a macro that will search them out for you. The following macro, FindLocked, starts at the beginning of a document and finds locked fields. It selects each locked field, in turn, and asks you if you want to continue searching.
Sub FindLocked()
Dim iField As Integer
Dim vResponse As Variant
For iField = 1 To ActiveDocument.Fields.Count
If ActiveDocument.Fields(iField).Locked Then
ActiveDocument.Fields(iField).Select
vResponse = MsgBox("Continue Searching?", vbYesNo)
If vResponse = vbNo Then Exit For
End If
Next iField
End Sub
Tip #1367 applies to Microsoft Word versions: 97 2000 2002 2003 2007
Ultimate Library! An amazing resource that brings together, in one place, the collected knowledge of everything ever published in WordTips. The library combines two powerful elements to make you more productive: solutions and convenience. Here's where you get your own copy of everything ever published in WordTips.
Check out WordTips Ten-Year Library today!
Discover how to use Word's mail merge tool to create your own custom documents in just minutes. Great e-book answers all your questions. (more information...)
Ask a Word Question
Make a Comment
Beauty Tips
Car Tips
Cleaning Tips
College Tips
Cooking Tips
Excel2007 Tips
ExcelTips
Family Tips
Gardening Tips
Health Tips
Home Tips
Money Tips
Organizing Tips
Pest Tips
Pet Tips
Word2007 Tips
WordTips