G
grixnair
We are in the process of converting to Word 2007 and some of my users
are complaining about the number of clicks required to protect and
unprotect their documents, so I am trying to add a button to the Quick
Access Toolbar that will change the protection. So far I am able to
get the unprotect to work, but I am getting an error when trying to
protect it.
The macro I have mapped to the button is this:
Sub ChangeProtection()
If ActiveDocument.ProtectionType <> wdAllowOnlyFormFields Then
ActiveDocument.Protect wdAllowOnlyFormFields, True
Else
ActiveDocument.Unprotect
End If
End Sub
I use similar code in some of the templates I've created without any
problems, but calling the code from a button on the Quick Access
Toolbar doesn't work. I get an error message box that doesn't provide
any information at all.
I tried putting a breakpoint in the code so that I could step through
it but it gives me the error without hitting my breakpoint. So I
created another macro to just do the Protect part that gets me a
warning message box that has a message of "Arguement not optional"
Sub Protect()
If ActiveDocument.ProtectionType = wdNoProtection Then
ActiveDocument.Protect Type:=wdAllowOnlyFormFields, _
NoReset:=True
End If
End Sub
Any help or suggestions would be greatly appreciated.
Dan
are complaining about the number of clicks required to protect and
unprotect their documents, so I am trying to add a button to the Quick
Access Toolbar that will change the protection. So far I am able to
get the unprotect to work, but I am getting an error when trying to
protect it.
The macro I have mapped to the button is this:
Sub ChangeProtection()
If ActiveDocument.ProtectionType <> wdAllowOnlyFormFields Then
ActiveDocument.Protect wdAllowOnlyFormFields, True
Else
ActiveDocument.Unprotect
End If
End Sub
I use similar code in some of the templates I've created without any
problems, but calling the code from a button on the Quick Access
Toolbar doesn't work. I get an error message box that doesn't provide
any information at all.
I tried putting a breakpoint in the code so that I could step through
it but it gives me the error without hitting my breakpoint. So I
created another macro to just do the Protect part that gets me a
warning message box that has a message of "Arguement not optional"
Sub Protect()
If ActiveDocument.ProtectionType = wdNoProtection Then
ActiveDocument.Protect Type:=wdAllowOnlyFormFields, _
NoReset:=True
End If
End Sub
Any help or suggestions would be greatly appreciated.
Dan