Locked property as it applies to the Field, LinkFormat, MailMergeField, and Subdocument objects.
Subdocument object: True if a subdocument in a master document is locked.
LinkFormat object: True if a Field, InlineShape, or Shape object is locked to prevent automatic updating. If you use this property with a Shape object that's a floating linked picture (a picture added with the AddPicture method of the Shapes object), an error occurs.
expression Required. An expression that returns one of the above objects.
Locked property as it applies to the Fields object.
True if all fields in the Fields collection are locked. Can be True, False, or wdUndefined (if some of the fields in the collection are locked). Read/write Long.
expression Required. An expression that returns a Fields object.
As it applies to the Subdocument object.
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
As it applies to the Fields object.
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