Ask Learn
Preview
Please sign in to use this experience.
Sign inThis browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
You can add protection to Microsoft Office Word documents to prevent users from making any edits to the document.
Applies to: The information in this topic applies to document-level projects and VSTO Add-in projects for Word. For more information, see Features available by Office application and project type.
You can also mark certain areas of the document as exceptions so that specified users can edit only those areas of the document. For example, you might want to protect an entire document except for a particular bookmark. You can optionally add a password so that users cannot remove the document protection unless they know the password.
Note
The following example does not use password protection; however, you might want to consider using a password when adding document protection. For more information, see the Document Protector Sample at Office development samples and walkthroughs.
You can also use content controls to protect parts of documents. For more information, see How to: Protect parts of documents by using content controls.
Call the Protect method of the ThisDocument
class in your project.
Protect the entire document using the Protect method.
Exclude Bookmark1
from the document protection.
To use these code examples, run them from the ThisDocument
class in your project. These code examples assume you have an existing Bookmark control named Bookmark1
on the document in which this code appears.
Please sign in to use this experience.
Sign in