Shortcut key help!!!!

  • Thread starter Thread starter Ernie Wyles
  • Start date Start date
E

Ernie Wyles

I've created forms at work that use check box form fields
and text form fields. From time to time, we have to
unprotect and protect our documents to use them. My
question is this. Is there a keyboard shortcut that will
toggle the "Protect Form/Unprotect Form" button?
 
Ernie,

No, but you could set one up.
Tools>Customize
click Keyboard button
choose Category: Tools
choose Command: ToolsProtectUnprotectDocument
enter the shortcut key combination you want to use in the space provided
click Assign
click Close
click Close

Regards,
Chad
 
Anybody have an idea what I'm missing?

I tried to toggle the forms protection with a macro (so as not to be
bothered by a dialog or the "Protect document" task pane).

Sub TurnFormsProtectionOnOff()
MsgBox Selection.Sections(1).ProtectedForForms,, _
"Section protected?"
Selection.Sections(1).ProtectedForForms = _
Not Selection.Sections(1).ProtectedForForms
End Sub

It doesn't seem to work for some reason in Word2002/2003 :-(

Regards,
Klaus
 
Klaus,

Sections(x).ProtectedForForms will set whether or not a particular section
is protected when protection is applied, but it will not apply the
protection. For that you need something like

ActiveDocument.Protect ProtectionType:=wdAllowOnlyFormFields, NoReset:=True,
Password:="abcd"

Or to unprotect the document:

ActiveDocument.Unprotect Password:="abcd"

Regards,
Chad
 
Chad DeMeyer said:
Sections(x).ProtectedForForms will set whether or not a
particular section is protected when protection is applied,
but it will not apply the protection. [...]


Aah, I see, thanks!! Makes sense, but I wasn't able to figure that out
from the help text.

So a macro to toggle the forms protection might look like

Select Case ActiveDocument.ProtectionType
Case wdAllowOnlyFormFields
ActiveDocument.Unprotect
Case wdNoProtection
ActiveDocument.Protect _
Type:=wdAllowOnlyFormFields, _
NoReset:=True
Case Else
MsgBox "WdProtectionType: " & _
ActiveDocument.ProtectionType, , _
"Document is already protected"
End Select

This applies to the whole doc. Toggling the protection just for the current
section (as was my original plan) looks like more trouble than it's worth.

Greetings,
Klaus
 
Precisely, but I think the implicit type conversion of ProtectionType to
string in the msgbox function will return the numeric constant in string
form rather than the nice, descriptive "wdAllowOnlyComments", etc. For that
you'd need to add a specific case for each of the other return values and
hard code the description string in the msgbox function.

Hard to imagine many scenarios where it would be useful to change the
ProtectedForForms property at run-time, but you never know.

Regards,
Chad


Klaus Linke said:
Chad DeMeyer said:
Sections(x).ProtectedForForms will set whether or not a
particular section is protected when protection is applied,
but it will not apply the protection. [...]


Aah, I see, thanks!! Makes sense, but I wasn't able to figure that out
from the help text.

So a macro to toggle the forms protection might look like

Select Case ActiveDocument.ProtectionType
Case wdAllowOnlyFormFields
ActiveDocument.Unprotect
Case wdNoProtection
ActiveDocument.Protect _
Type:=wdAllowOnlyFormFields, _
NoReset:=True
Case Else
MsgBox "WdProtectionType: " & _
ActiveDocument.ProtectionType, , _
"Document is already protected"
End Select

This applies to the whole doc. Toggling the protection just for the current
section (as was my original plan) looks like more trouble than it's worth.

Greetings,
Klaus
 
Back
Top