View Single Post
 
Old 08-14-2013, 08:13 AM
bandrist bandrist is offline Windows 7 32bit Office 2010 32bit
Novice
 
Join Date: Aug 2013
Posts: 2
bandrist is on a distinguished road
Default Uncheck Checkbox Code not working if document protected

I'm a total novice when it comes to VBA. I found the following code on another forum and copied it in order to program a command button to reset form fields on a Word document that is protected. The text boxes and drop downs are resetting properly but the checkboxes are not becoming unchecked while protection is on. However, if I stop protection and click the command button, the check boxes become unchecked. How can I get this to work when the document is protected?

Private Sub CommandButton1_Click()
Dim oFF As FormField
For Each oFF In ActiveDocument.Range.FormFields
Select Case oFF.Type
Case Is = wdFieldFormTextInput
oFF.Result = ""
Case Is = wdFieldFormDropDown
oFF.DropDown.Value = 1
Case Is = wdFieldFormCheckBox
oFF.Result = False
End Select
Next oFF
End Sub
Reply With Quote