Locked Property Example

This example checks the first subdocument in the specified master document and sets the master document to allow only comments if the subdocument is locked.

If ActiveDocument.Subdocuments(1).Locked = True Then
    ActiveDocument.Protect Type:=wdAllowOnlyComments
End If

This example inserts a DATE field at the beginning of the selection and then locks the field.

Selection.Collapse Direction:=wdCollapseStart
Set myField = ActiveDocument.Fields.Add(Range:=Selection.Range, _
    Type:=wdFieldDate)
myField.Locked = True

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