Document.Protect Method (Word)

Office 2013 and later
GitHub-Mark-64px

Contribute to this content

Use GitHub to suggest and submit changes. See our guidelines for contributing to VBA documentation.

Protects the specified document from unauthorized changes.

expression .Protect(Type,NoReset,Password,UseIRM,EnforceStyleLock)

expression A variable that represents a Document object.

Parameters

Name

Required/Optional

Data type

Description

Type

Required

WdProtectionType

The type of protection to apply.

NoReset

Optional

VARIANT

False to reset form fields to their default values; True to retain the current form field values if the document is protected. If Type is not wdAllowOnlyFormFields, NoReset is ignored.

Password

Optional

VARIANT

If supplied, the password to be able to edit the document, or to change or remove protection.

UseIRM

Optional

VARIANT

Specifies whether to use Information Rights Management (IRM) when protecting the document from changes.

EnforceStyleLock

Optional

VARIANT

Specifies whether formatting restrictions are enforced for a protected document.

Type

Required

WDPROTECTIONTYPE

NoReset

Optional

VARIANT

Password

Optional

VARIANT

UseIRM

Optional

VARIANT

EnforceStyleLock

Optional

VARIANT

Return value

VOID

Concepts

Other resources

Show: