Quote:
Originally Posted by Guessed
Are you using a password on the form protection? Assuming there is no password, and the form is protected before the macro is run, the following modifications would be required.
Code:
Sub ClearForm()
Dim aCC As ContentControl
ActiveDocument.Unprotect
For Each aCC In ActiveDocument.ContentControls
aCC.Range.Select
If aCC.Type <> wdContentControlDropdownList Then
aCC.Range.Text = ""
Else
aCC.Type = wdContentControlText
aCC.Range.Text = ""
aCC.Type = wdContentControlDropdownList
End If
Next aCC
ActiveDocument.Protect wdAllowOnlyFormFields
End Sub
This code will fail if the form is not already protected or has a password so a better solution would be to add more lines of code to check first.
|
there is no password .
I may have been wrong somewhere.
I've done a process of:
Fill out details,
Activating the macro to clear the details,
(happy)
Protect form (no password).
I will try again.