Protect Method

See Also         Example         Applies To

Protects the specified document from changes. When a document is protected, the user can make only limited changes, such as adding annotations, making revisions, or completing a form.

Note   If the document is already protected when you use this method, an error occurs.

Syntax

expression.Protect(Type, NoReset, Password)

expression   Required. An expression that returns a Document object.

Type   Required Long. The protection type for the specified document. Can be one of the following WdProtectionType constants: wdAllowOnlyComments, wdAllowOnlyFormFields, wdAllowOnlyRevisions, or wdNoProtection.

NoReset   Optional Variant. False to reset form fields to their default values. True to retain the current form field values if the specified document is protected. If Type isn't wdAllowOnlyFormFields, the NoReset argument is ignored.

Password   Optional Variant. The password required to "unprotect" the specified document.