S
Simon Svensson
Hello.
I'm executing a macro in a document with an active document protection that
only allow form editing. The macro works as expected when document protection
is disabled, but will always cause the control to be readonly when the
document is protected.
Reproduce:
1) Create a new macro-enabled document (docm), add a content control of type
text and an normal button from the dropdown of controls from earlier controls.
2) Edit the macro for the onclick event of the button to the following:
ActiveDocument.ContentControls(1).LockContents = _
ActiveDocument.ContentControls(1).LockContents
3) Change the content of the content control. It should work.
4) Click the button and try and edit the content. It should work.
5) Apply document protection using "Only allow these edits: Edit forms"
6) Verify that editing the content control works.
7) Press the button.
Editing of the content control should now work, but it doesnt. I get a
keyboard cursor and can select text, but typing anything on the keyboard wont
change the content of the control. No notice is shown about changes not being
allowed due to a locked control.
13) Disabled the document protection, but dont click the button.
14) Editing works again.
To summarize; setting a custom controls LockContents via a macro when
document protection that only allows form editing is activated will always
cause the custom control to be readonly. It doesnt matter what value I give
to LockContents.
Any thoughts? Solutions?
Thanks.
Simon Svensson
I'm executing a macro in a document with an active document protection that
only allow form editing. The macro works as expected when document protection
is disabled, but will always cause the control to be readonly when the
document is protected.
Reproduce:
1) Create a new macro-enabled document (docm), add a content control of type
text and an normal button from the dropdown of controls from earlier controls.
2) Edit the macro for the onclick event of the button to the following:
ActiveDocument.ContentControls(1).LockContents = _
ActiveDocument.ContentControls(1).LockContents
3) Change the content of the content control. It should work.
4) Click the button and try and edit the content. It should work.
5) Apply document protection using "Only allow these edits: Edit forms"
6) Verify that editing the content control works.
7) Press the button.
Editing of the content control should now work, but it doesnt. I get a
keyboard cursor and can select text, but typing anything on the keyboard wont
change the content of the control. No notice is shown about changes not being
allowed due to a locked control.
13) Disabled the document protection, but dont click the button.
14) Editing works again.
To summarize; setting a custom controls LockContents via a macro when
document protection that only allows form editing is activated will always
cause the custom control to be readonly. It doesnt matter what value I give
to LockContents.
Any thoughts? Solutions?
Thanks.
Simon Svensson