form field drop down 25 limit list, I have made a fix (of sorts)

  • Thread starter OTWarrior via OfficeKB.com
  • Start date
O

OTWarrior via OfficeKB.com

The form fields drop down list has a limit of 25 options, which can be a
problem if you want more than 25 options.

The only answers I have seen are to use a Userform (which has the option of
pulling data from and external source or not) or to use activeX controls.
Both of these options can be trouble depending on what you are doing.

In my case, I need the drop down box(es) to be on an official document that
is used byt many different teams. So I have come up with the following option
of changing the list when you select the last option, thus making you have 48
items (2 of them being the "next" and "previous" options)


Sub filler()

Dim Data As Variant
Data = Array("One", "Two", "Three", "...Previous list..")
Dim Data2 As Variant
Data2 = Array("Option1", "Select Me", "Test Data", "...Next list...")

Dim i As Integer, i2 As Integer


If ActiveDocument.FormFields("Dropdown1").Result = Data2(3) Then
ActiveDocument.FormFields("Dropdown1").DropDown.ListEntries.Clear
For i = LBound(Data) To UBound(Data)
ActiveDocument.FormFields("Dropdown1").DropDown.ListEntries.Add Data
(i)
Next i
ElseIf ActiveDocument.FormFields("Dropdown1").Result = Data(3) Then
ActiveDocument.FormFields("Dropdown1").DropDown.ListEntries.Clear
For i2 = LBound(Data2) To UBound(Data2)
ActiveDocument.FormFields("Dropdown1").DropDown.ListEntries.Add Data2
(i2)
Next i2
End If

End Sub

...(running the macro either when entering the form field or exiting is fine,
but not both)

Hopefully, this will help anyone who has had a similar problem to me. let me
know if it has been of use to you.
 

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