Can a key for all form fields in a document be generated?

F

foreplease

I have created a template using Word 2000. It has many text and drop-down
form fields. Usually, this will be completed on computer and the choices are
presented to the user one field at a time. Occasionally, this form will need
to be completed on paper in the field (pesticide application business) and I
need the user to know exactly what all of the available choices are for each
field. Is there a way to generate or print a form field key that the user
could reference when filling out the form manually?

Thank you.
 
D

Doug Robbins - Word MVP

If the number of choices is not too many, it might be better to use
checkboxes.

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP
 
F

foreplease

Thank you for your reply. Unfortunately, the form template with form fields
is complete and I now need a way to come up with a key for those who use it
on paper. I suppose I could do it manually for those who use it manually.
With enough copying and pasting I can produce what I need. I hoped there
would be a way to do it automatically.
 
D

Doug Robbins - Word MVP

If you run a macro containing the following code when your form is the
activedocument, it will create a new document that contains as list of the
entries in each dropdown formfield in your form:

Dim Source As Document, Target As Document
Dim i As Long, j As Long
Dim Dropdownlist As String
Set Source = ActiveDocument 'Your form
Set Target = Documents.Add
With Source
For i = 1 To .FormFields.Count
With .FormFields(i)
If .DropDown = True Then
Dropdownlist = ""
For j = 1 To .DropDown.ListEntries.Count - 1
.DropDown.Value = j
Dropdownlist = Dropdownlist & .Result & vbCr
Next j
.DropDown.Value = .DropDown.ListEntries.Count
Dropdownlist = Dropdownlist & .Result
Target.Range.InsertAfter "The items for DropDown FormField "
& .Name & " are:" & vbCr & _ Dropdownlist & vbCr
End If
End With
Next
End With




--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP
 
F

foreplease

Incredible. Thank you so much. I feel like I am almost there. I created a
macro (my first). An error message came up: Compile Error Syntax Error with
this line highlighted: "& .Name & " are:" & vbCr & _ Dropdownlist & vbCr" The
only thing I did different from what you suggested is that I left the End Sub
in place since it was inserted at the end automatically. I could see that
your code was trying though!
 
D

Doug Robbins - Word MVP

The email program has put a line break in the wrong place. All of the
following should be on one line in the Visual Basic Editor.

Target.Range.InsertAfter "The items for DropDown FormField " & .Name & "
are:" & vbCr & Dropdownlist & vbCr


--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP
 
F

foreplease

That took care of it. Your macro generated a nine-page document that I can
easily format. This will help me look like a pro in the field and ensure that
the questions that must be answered are completed consistenly from one time
to the next.

Thank you for going the extra mile to help solve this quirky problem.
 
D

Doug Robbins - Word MVP

My pleasure.

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - 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