none
word protection problem with DOCX files. RRS feed

  • Question

  • I have protect my word file with ProtectType.CommentOnly but it not works properly with .DOCX file. It will lock whole word file [ProtectType.ReadOnly].
    Same code works fine with .DOC files.

    Is it version problem [Enterprise/Professional]?

    how can i solve this ? any help ?

    Has anyone faced this before ?

    Tuesday, September 27, 2011 4:51 AM

Answers

  • I have protect my word file with ProtectType.CommentOnly but it not works properly with .DOCX file. It will lock whole word file [ProtectType.ReadOnly].
    Same code works fine with .DOC files.

    Is it version problem [Enterprise/Professional]?

    how can i solve this ? any help ?

    Has anyone faced this before ?


    Using ActiveDocument.Protect Type:=wdAllowOnlyComments in Word 2010 works as intended here.  The text in the document cannot be edited, but comments can be inserted.
    Doug Robbins - Word MVP dkr[atsymbol]mvps[dot]org
    • Marked as answer by Liliane Teng Monday, October 3, 2011 10:42 AM
    Tuesday, September 27, 2011 9:46 AM
  • I tried the command, that Doug Robbins shared, with doc and docx files on Word 2003, 2007, and 2010.  It worked as expected and only allowed comments to be entered.

    Specifically what problem are you having with the docx format and are you using the command syntax as Doug provided?


    Kind Regards, Rich ... http://greatcirclelearning.com
    • Marked as answer by Liliane Teng Monday, October 3, 2011 10:42 AM
    Tuesday, September 27, 2011 10:53 AM
  • Hi koolprasad2003,

    How do you define the objDoc variable? Is it defined as Word.Document? Below code works, please have a try and let us know the situation on your side.

    Dim docApp As Word.Application
    Dim objDoc As Word.Document
    Set docApp = Word.Application.Activate
    Set objDoc = docApp.ActiveDocument
    objDoc.Protect Type:=wdAllowOnlyComments
    

    Have a nice day.

    Best regards

     


    Liliane Teng [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    • Marked as answer by Liliane Teng Monday, October 3, 2011 10:42 AM
    Friday, September 30, 2011 9:35 AM

All replies

  • I have protect my word file with ProtectType.CommentOnly but it not works properly with .DOCX file. It will lock whole word file [ProtectType.ReadOnly].
    Same code works fine with .DOC files.

    Is it version problem [Enterprise/Professional]?

    how can i solve this ? any help ?

    Has anyone faced this before ?


    Using ActiveDocument.Protect Type:=wdAllowOnlyComments in Word 2010 works as intended here.  The text in the document cannot be edited, but comments can be inserted.
    Doug Robbins - Word MVP dkr[atsymbol]mvps[dot]org
    • Marked as answer by Liliane Teng Monday, October 3, 2011 10:42 AM
    Tuesday, September 27, 2011 9:46 AM
  • I tried the command, that Doug Robbins shared, with doc and docx files on Word 2003, 2007, and 2010.  It worked as expected and only allowed comments to be entered.

    Specifically what problem are you having with the docx format and are you using the command syntax as Doug provided?


    Kind Regards, Rich ... http://greatcirclelearning.com
    • Marked as answer by Liliane Teng Monday, October 3, 2011 10:42 AM
    Tuesday, September 27, 2011 10:53 AM
  • thanks for reply doug,

                the problem is,  i tried with objDoc.ProtectType. not with ActiveDocument.ProtectType.

    should i try with ActiveDocument ?

    Tuesday, September 27, 2011 12:36 PM
  • Hi koolprasad2003,

    How do you define the objDoc variable? Is it defined as Word.Document? Below code works, please have a try and let us know the situation on your side.

    Dim docApp As Word.Application
    Dim objDoc As Word.Document
    Set docApp = Word.Application.Activate
    Set objDoc = docApp.ActiveDocument
    objDoc.Protect Type:=wdAllowOnlyComments
    

    Have a nice day.

    Best regards

     


    Liliane Teng [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    • Marked as answer by Liliane Teng Monday, October 3, 2011 10:42 AM
    Friday, September 30, 2011 9:35 AM