Can I create an unprotected formfield in a protected document?

R

Rich

I have created a form in Word that has formfields. Using the Protect Document
panel, I can set the document protection to Read Only and then create
Exceptions for my formfields such that they are freely editable. Why? I want
the formfields to be editable both in terms of content and format.

My question is: how can I do this same thing programatically? I have a macro
that creates a new formfield in the document, but I want to programatically
create an editing restriction exception for the formfield so that it is also
freely editable (content and format).

Thanks,

Rich
 
J

Jean-Guy Marcil

Rich was telling us:
Rich nous racontait que :
I have created a form in Word that has formfields. Using the Protect
Document panel, I can set the document protection to Read Only and
then create Exceptions for my formfields such that they are freely
editable. Why? I want the formfields to be editable both in terms of
content and format.

My question is: how can I do this same thing programatically? I have
a macro that creates a new formfield in the document, but I want to
programatically create an editing restriction exception for the
formfield so that it is also freely editable (content and format).

Set a range to the newly created formfield, and use something like:

ActiveDocument.Unprotect

myRange.Editors.Add wdEditorEveryone

ActiveDocument.Protect Password:="", NoReset:=False, Type:= _
wdAllowOnlyReading, UseIRM:=False, EnforceStyleLock:=False

But, once the user stars typing in the formfield, it is gone, it becomes
normal text. So, do not use OnExit macros and the like...

--
Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
[email protected]
Word MVP site: http://www.word.mvps.org
 
Top