Clearing Fields in a Word Form


Joined
Sep 29, 2019
Messages
2
Reaction score
0
I've created a form in Word 2010 that contains Rich Text, Drop Down, and Date controls. I've created a macro button on the Quick Access Toolbar that is supposed to clear all the fields. I found on this forum a thread that I thought would do this but the programming code does not seem to be working. Note: Through the developer I have restricted the user to only be able to change the form fields. Here is the macro code.
Dim fld As FormField
For Each fld In ActiveDocument.FormFields
If fld.Type = wdFieldFormTextInput Then
fld.Result = ""
ElseIf fld.Type = wdFieldFormCheckBox Then
fld.CheckBox.Value = False
ElseIf fld.Type = wdFieldFormDropDown Then
fld.DropDown.Value = 1
End If
Next

Can anyone tell me what I need to do to make this macro work. Thanks
 
Ad

Advertisements

macropod

Microsoft MVP
Joined
Mar 2, 2012
Messages
465
Reaction score
40
Formfield code doesn't work with content controls. In any event, if you used a template, you probably wouldn't need to clear the contents.
 
Joined
Sep 29, 2019
Messages
2
Reaction score
0
Thank you for the information. The application in which the form is to be used is for a desk volunteer, as customers come up to the desk, fill the form out, print, clear the form and then repeat for each customer in the line. The objective is to minimize the keystrokes/mousing between each action of filling the form out and printing. What I would optimally want is a print and a clear button within the form itself and allow the form to be displayed without the outer trappings of word. But I realize that is probably not possible, or is it. Therefore a quick access button that cleared the contents of the form's fields is a compromise that I feel the learning curve would be low for the desk volunteers. Any help in reaching the objective for this form's use would be appreciated.

PS. I know just enough about program language to somewhat understand when reading but not to actually write the code.
 
Ad

Advertisements

macropod

Microsoft MVP
Joined
Mar 2, 2012
Messages
465
Reaction score
40
In that case you should be using a template. Once you're finished with a given form, simply close it then create a new one from the template. No code required.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Clear button for template 1

Top