MS Word Drop-Down list linked to outside source?

Y

Yotafan

I was wondering if it is possible to link a word drop down list to an outside
source such as an Excel list or and Access table.

My Scenario:
I have created 70+ locked templates that use some similiar drop down lists.
These lists include Judges, Lawyers, and Arbitrators names that can change
monthly. So i was looking for a better solution than me editing every drop
down list on each template.


I would like to be able to link a drop down list to say an MS Access table
and so i can just edit the table and each drop down would just pull the info
from that.

Is this possible to do or is there a better solution?
TIA

Ed
 
G

Graham Mayor

What sort of dropdown list in what Word version?

If you mean formfield dropdown lists, then subject to the proviso that such
lists can only hold 25 entries, then it is relatively simple to populate the
list(s) from an external table with a macro. In the following example the
macro uses the first column of a Word table to populate a dropdown field
called Dropdown1. You can use the same table to populate a variety of named
dropdown fields and it is not too much of a stretch to import the data from
an Excel or Access table. If all the templates use the same named dropdown
fields the same macro can be used to populate each of them as required.
http://www.gmayor.com/installing_macro.htm

Dim oItem As Range
Dim iRows As Long
Dim RefDoc As Document
Dim ChangeDoc As Document
Dim oDD As DropDown
Set RefDoc = ActiveDocument
Set oDD = RefDoc.FormFields("Dropdown1").DropDown
sfName = "D:\My Documents\Test\Judges.docx"
'Clear previous list
oDD.ListEntries.Clear
'Repopulate list based on user selection
Set ChangeDoc = Documents.Open(sfName)
Set cTable = ChangeDoc.Tables(1)
RefDoc.Activate
iRows = cTable.Rows.Count
If iRows > 25 Then iRows = 25
For i = 1 To iRows
Set oItem = cTable.Cell(i, 1).Range
oItem.End = oItem.End - 1
If oItem.Text = "" Then Exit For
oDD.ListEntries.Add oItem.Text
Next i
ChangeDoc.Close wdDoNotSaveChanges

I think that in practice - and especially for longer lists - I would create
a userform to select the data, and populate the form with docvariable fields
For the basics, see Word MVP FAQ - Userforms
http://word.mvps.org/FAQs/Userforms.htm

for a more in depth explanation, see
http://gregmaxey.mvps.org/Create_and_employ_a_UserForm.htm

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