Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Check if Word Doc Protected? 1

Status
Not open for further replies.

cheriberi

Technical User
May 27, 2003
60
US
I'm sure this is easy, but I can't figure it out. How do I check in a Word macro whether a document is protected or not? I need to make sure it is not protected and if it is, unprotect it.

Thanks!
 
I use the following code to check if a document has been protected for forms:

If ActiveDocument.ProtectionType = wdAllowOnlyFormFields Then
ActiveDocument.Unprotect
End If

But if you are checking whether the form has been protected for tracked changes or comments you will have to change the ProtectionType.

Bear in mind that if you want to re-protect the form you should do so in code or Word will clear all the input fields
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top