I recorded this code. Need to protect different sections in the document.
But when I run this code nothing heppens. Something is missing... Thanks for
any help,
ActiveDocument.Sections(1).ProtectedForForms = False
ActiveDocument.Sections(2).ProtectedForForms = True
I think you'll find that the code has set the protection for section 2 (Tools
> Protect Document... > Forms: >Sections...).
You need to protect the document in order to see the protection at work:
ActiveDocument.Protect _
Password:="", _
NoReset:=False, _
Type:=wdAllowOnlyFormFields
Set the password to whatever you want (or nothing, or prompt the user for a
password). Change NoReset to True if you don't want existing form field
contents to be erased on protect.
> I recorded this code. Need to protect different sections in the document.
> But when I run this code nothing heppens. Something is missing... Thanks for
> any help,
>
> ActiveDocument.Sections(1).ProtectedForForms = False
> ActiveDocument.Sections(2).ProtectedForForms = True