Fields.Locked property (Word)

True if all fields in the Fields collection are locked. Read/write Long.

Syntax

expression.Locked

expression Required. A variable that represents a 'Fields' collection.

Remarks

This property can be True, False, or wdUndefined (if some of the fields in the collection are locked and others are not).

Example

This example locks all the fields in the selection.

Selection.Fields.Locked = True

This example displays a message if some of the fields in the active document are locked.

Set theFields = ActiveDocument.Fields 
If theFields.Locked = wdUndefined Then 
 MsgBox "Some fields are locked" 
ElseIf theFields.Locked = False Then 
 MsgBox "No fields are locked" 
ElseIf theFields.Locked = True Then 
 MsgBox "All fields are locked" 
End If

See also

Fields Collection Object

Support and feedback

Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.