MACRO TO CLEAR A FORM

  • Thread starter Re: Pivot Table/Query
  • Start date
R

Re: Pivot Table/Query

I have created a form for use in my office. I would like to have a "clear"
or "reset" button at the top so that the data can be cleared from the form.
Is there an easy way (I"m assuming a macro is needed with a button).
 
G

Graham Mayor

If you save the form without the data as a template and create new documents
from it it won't need clearing. However

Sub ClearForm()
Dim oFld As FormFields
Set oFld = ActiveDocument.FormFields
For i = 1 To oFld.Count
If oFld(i).Type = wdFieldFormDropDown Then
oFld(i).Result = " "
Else
oFld(i).Result = ""
End If
Next
End Sub

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP


<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 

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

Top