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.
|
The two codes you -
Guessed & gmaxey- provided me , are working
very effectively!
When I applied them to more forms, especially with a few boxes, they work perfectly!
I'll have to make do with it right now.
I need to take the time and try to learn more about the "preparation" of the form for the code , all in order to make intelligent use of the useful codes that you have given me.
Thank you very very much for your warm hospitality and helpful explanations.