VBA code in word 2007 for "protect" and "unprotect" buttons
I want to put two buttons inside a word document (word 2007): Protect and Unprotect. It's actually a form. How do I write the code for those two buttons? I mean, what is the actual code I need to write?
It depends on what type of protection you want to apply. Here is one example.
Sub Prot()
'A basic Word macro coded by Greg Maxey
ActiveDocument.Protect wdAllowOnlyFormFields, True
End Sub
Sub UnProt()
'A basic Word macro coded by Greg Maxey
If ActiveDocument.ProtectionType <> wdNoProtection Then
ActiveDocument.Unprotect
End If
End Sub
If you are wanting the Classic Formfield tools back then see: