


If the protection does not have a password, uncheck the Protect box under Write protection. If the section is protected with a password and you want to change it, click on the Password button in the Edit Sections window and enter the correct password twice. If the protection has a password and you want to clear it, uncheck the With password box under Write protection and enter the correct password. If the protection does not have a password and you would like to use one, choose the With password checkbox, click the Password button, and enter and confirm a password of at least five characters. and select the section in the list Section, or right-click on the section in the Navigator and choose Edit. Enter and confirm a password of at least five characters.Ĭhoose menu Format - Sections. If you want the protection with a password, choose Protect and With password check boxes and click on the Password… button.

If you want to protect the contents without a password, choose the Protect check box under the Write protection. If the section already exists: Choose menu Format - Sections. If the section does not exist: Select the text, then choose menu Insert - Section. Information to protect must be in a section. Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.Protection is not intended to be an information security protection, it is a switch to prevent accidental changes. If aDoc.ProtectionType wdNoProtection ThenĪDoc.Protect Type:=wdAllowOnlyRevisions, Password:=strPassword Text is inserted, and the document is protected for revisions. This example removes protection from the active document. If ActiveDocument.ProtectionType wdNoProtection ThenĪctiveDocument.Unprotect Password:=strPassword This example removes protection from the active document, using the value of the strPassword variable as the password. If the document isn't protected, this method generates an error. For recommended best practices on how to do this, see Security notes for Office solution developers. If a password is required in a procedure, request the password from the user, store it in a variable, and then use the variable in your code. Avoid using hard-coded passwords in your applications.
