R
Ricki Miles
I am creating a template in Word 2003 that is protected for form fields. I
would like a macro to unprotect the form (retaining the data in the form
fields) so that users can edit the footer. I would like another macro to
reprotect the form. I currently have a macro for each that will unprotect
and reprotect, but if the document is protected and the protect macro is
run, an error occurs. Similarly, if the document is unprotected and the
unprotect macro is run, an error occurs as well. How can I change the VBA
code so that if the document is already protected and the protect macro is
run, nothing happens and the same for unprotect. Below is the code I was
using. Thanks,
Ricki
If ActiveDocument.ProtectionType = wdNoProtection Then
ActiveDocument.Protect Type:=wdAllowOnlyFormFields, NoReset:=True
Else
ActiveDocument.Unprotect
End If
would like a macro to unprotect the form (retaining the data in the form
fields) so that users can edit the footer. I would like another macro to
reprotect the form. I currently have a macro for each that will unprotect
and reprotect, but if the document is protected and the protect macro is
run, an error occurs. Similarly, if the document is unprotected and the
unprotect macro is run, an error occurs as well. How can I change the VBA
code so that if the document is already protected and the protect macro is
run, nothing happens and the same for unprotect. Below is the code I was
using. Thanks,
Ricki
If ActiveDocument.ProtectionType = wdNoProtection Then
ActiveDocument.Protect Type:=wdAllowOnlyFormFields, NoReset:=True
Else
ActiveDocument.Unprotect
End If