Click here to Skip to main content
15,068,988 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
We have a revision control system for word 2010 documents. The system was written with VB 6 and used for Word 2003 documents. When revision level changed we use a different protection to the document. After upgraded to Word 2010, this system failed to work. For example, when change protection type from wdAllowOnlyRevisions to wdAllowOnlyFormFields, the application unprotects the document and then protect the document with new protection type. However, after unprotect the document and before call protect method, in Review->Restrict Editing panel of the document, the "Allow only this type of editing in the document:" checkbox is still checked. As the result, the document is not protected as we want through the code, but what set in the checkbox. Are there any VBA/Word functions we can use to programmatically clear that checkbox in the Restrict Editing panel? Many thanks!
Posted

1 solution

First of all, you are telling us so many things we cannot comprehend. It's your revision control system. Though you are very familiar with it, we are NOT. What the heck is "Allow only this type of editing in the document:" checkbox for example?

Here's the answer: (I'm afraid I can't give a solution, but an answer)

Word file format changed drastically from doc to docx. for example, a *.doc file is a series of markup similar to RTF. But a *.docx file is a zip file which has the extension *.docx. What I'm trying to say is they are completely different in format.

So if your system was built for doc and now you want to handle docx with it, you simply can't. You will have to re-implement it for docx as well.
   
Comments
zengfuxu 22-Feb-12 21:14pm
   
Sorry my question is:
We would like to enforce and remove different types of Document Protection (Restrict Editing) on a whole Word 2010 document in code.
Our code has worked in previous version of Word but is no longer working with the new version. When changing protection type from
wdAllowOnlyRevisions to wdAllowOnlyFormFields, our code is designed to unprotect the document and then protect it with a new
protection type as follows.

ProtectioType = ActiveDocument.ProtectionType
If ProtectioType = wdAllowOnlyRevisions Then
ActiveDocument.Unprotect()
ActiveDocument.Protect(Password:="xxxxx", NoReset:=True, Type:= wdAllowOnlyFormFields, UseIRM:=False, EnforceStyleLock:=False)
End If

After ActiveDocument.Unprotect executed, ActiveDocument.ProtectionType becomes -1 which is correct. But in the document
the Restrict Editing pane (From the document ribbon menu Review -> Restrict Editing) settings are not changed. The
"2. Allow only this type of editing in the document:" checkbox is still checked for "Tacked changes". Therefore,
when code ActiveDocument.Protect is executed, wdAllowOnlyFormFields protection type is not applied and it keeps wdAllowOnlyRevisions.

However, after unprotecting the document in code and before calling the protect method in code,
the "2. Allow only this type of editing in the document:" checkbox is still checked (in the Review->Restrict
Editing panel in the ribbon menu of the document). As the result, the document is not protected as we want it to be when using the code.

Are there any VBA/Word functions we can use to programmatically clear that checkbox in the Restrict Editing panel? Many thanks!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900