I would like to use vba to protect my word document.
Indeed, it is possible but I've searched on how to unprotect the document through this link :
http://www.aurelp.com/2015/04/01/how-to-unlock-a-microsoft-word-document-step-by-stepsolved/
Is there any other way on how to successfully protect the document from unauthorized user?
Using VBA, I believe you'd be looking for the protect
method:
Application.ActiveDocument.Protect wdAllowOnlyRevisions, password:="password"
With protect
, you can specify the type of protection, the password, and various components of the protection (style lock, resetting of form fields, etc.). More on protect
can be found here .
Likewise, VBA has a similar method for unprotecting a Word document, if you know the password. This is the aptly named unprotect
method.
Application.ActiveDocument.Unprotect "password"
More on unprotect
can be found here .
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.