none
Difference Between Document.Permission and Document.Protect RRS feed

  • Question

  • I created a Word template used by an Access application to create a series of Word documents. To prevent users from making changes to the documents that the Access application created based on their entries, I programmatically protect the document after it created and before it is saved.  There is no password used.

    ActiveDocument.Protect Type:=wdAllowOnlyReading

    I also created a Word Add-In so that authorized users could protect or unprotect the document as needed. One of the users found a way to circumvent this by going to File>Info>Protect Document>Restrict Editing. All the User has to do is click the Stop Protecting button and the document is unprotected.

    What is the difference between using Document.Protect and Document.Permission to restrict editing the document? How can I restrict all editing to a document programmatically without using a password?

    Tuesday, February 27, 2018 6:13 PM

All replies

  • Hi kay_some,

    >> What is the difference between using Document.Protect and Document.Permission to restrict editing the document?

    What do you mean by Document.Permission? Do you mean Restrict Permission or File Permission?

    >> I also created a Word Add-In so that authorized users could protect or unprotect the document as needed

    How did you identify who is authorized users?

    If you authenticate User By account and name, I would suggest you protect the document by password. Do you have any issue with protecting a document by password?

    For another way to control the permission, you suggest you try File permission with read permission, you could control who could read and edit the document.

    If you prefer using restrict feature, using password is the only option.

    Best Regards,

    Tao Zhou


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Thursday, March 1, 2018 8:58 AM
  • Hello Tao,

    1.  What I mean by "Document.Permission" is using Information Management Rights to restrict access to a document.  Since the document is a template and will need to be totally unrestricted to fill in the ContentControls programmatically,  this would require code to restrict and unrestrict the new document using Information Management Rights.  Since my access to creating and modifying Groups in ActiveDirectory is 0, I would have to request every time we got a new employee to be added to the Group or deleted from the Group with Restricted Access.  Initially I used this option but it became cumbersome every time a new employee was added.

    2.  The Authorized Users are identified by their User Account.

    3.  My reason for not using a Password is every time a user accesses the Template document which could be multiple times a day the hard coded password would have to used.  I was trying to avoid using a hard coded Password.

    I still would like to know if I could use the Document.Protect property programmatically to lock the document and still keep users from unlocking the documents through Information Rights Management Restricted Access.  I'm trying to find out how each one works to determine which one or both to use.

    Thursday, March 1, 2018 10:22 PM
  • Hi kay_some,

    >> I still would like to know if I could use the Document.Protect property programmatically to lock the document and still keep users from unlocking the documents through Information Rights Management Restricted Access

    I am afraid not.

    For a workaround, I would suggest you add macro to Document_Open to check whether the current user could access the document.

    Best Regards,

    Tao Zhou


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Friday, March 2, 2018 2:37 AM