Syntax
ToolsProtectDocument [.DocumentPassword = text] [, .NoReset = number] [, .Type = number]
Remarks
Protects the document from changes. According to the value of .Type, the user can make limited changes such as adding annotations or revision marks. If the document is already protected, an error occurs.
Argument | Explanation | |
.DocumentPassword | The password required to "unprotect" the document after choosing Unprotect Document (Tools menu). | |
.NoReset | If 1, Word does not reset form fields to their default results when a form is protected from changes using ToolsProtectDocument (applies only if .Type is 2). This option allows the form designer to create an "on entry" or "on exit" macro that removes protection from the form, modifies the form, and then protects it again without resetting form fields. Note that form fields are always reset when you protect a form using the Forms toolbar or the Protect Document dialog box (Tools menu). | |
.Type | The type of protection: 0 (zero) or omitted Users can select and edit text, but all changes are tracked with revision marks. 1 Users can only add annotations. 2 Users can only select and modify text in form fields. To specify which sections of a multiple-section form |
Unlike FileSaveAs or ToolsOptionsSave, which you can use to protect a document from being opened or saved, ToolsProtectDocument controls what
the user is allowed to do while the document is open.
See Also
DocumentProtection(), FileSaveAs, ToolsOptionsSave, ToolsProtectSection, ToolsUnprotectDocument