Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Populating a List from a file in a Word VBA form

Status
Not open for further replies.

JudyL

Instructor
Feb 21, 2001
148
US
Is there a way to populate a list or combo box in a Word VBA form using an external file? This would allow someone to maintain the list that does not know VBA.
 
If your file is c:\combolines.txt, you can use

dim s as string
open "c:\combolines.txt" for input as #1
do while not eof(1)
line input#1,s
MyComboBox.additem s
loop
close#1

Each line in the text file is added to the combo box, in the same order as the text file.
Rob
[flowerface]
 
That was perfect. Thanks so much
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top