Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Fill a combobox on a form from a txt file
Can I open a notepad txt file that contains only a list of names, and use
that to fill a combobox on a form? Failing that, can populate the combobox from an Excel file, without having to open the Excel file? Thanks in advance Daniel |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Fill a combobox on a form from a txt file
Sub ReadStraightTextFile()
Dim sStr as String Dim LineofText As String Open "C:\FILEIO\TEXTFILE.TXT" For Input As #1 sStr = "" Do While Not EOF(1) Line Input #1, LineofText userform1.combobox1.AddItem LineofText Loop 'Close the file Close #1 End Sub -- Regards, Tom Ogilvy "Daniel Bonallack" wrote in message ... Can I open a notepad txt file that contains only a list of names, and use that to fill a combobox on a form? Failing that, can populate the combobox from an Excel file, without having to open the Excel file? Thanks in advance Daniel |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Fill a combobox on a form from a txt file
Thanks very much Tom.
If you just happen to have any questions about New Zealand Rugby teams, that's about the only way I'll ever by able to reciprocate! Daniel "Tom Ogilvy" wrote: Sub ReadStraightTextFile() Dim sStr as String Dim LineofText As String Open "C:\FILEIO\TEXTFILE.TXT" For Input As #1 sStr = "" Do While Not EOF(1) Line Input #1, LineofText userform1.combobox1.AddItem LineofText Loop 'Close the file Close #1 End Sub -- Regards, Tom Ogilvy "Daniel Bonallack" wrote in message ... Can I open a notepad txt file that contains only a list of names, and use that to fill a combobox on a form? Failing that, can populate the combobox from an Excel file, without having to open the Excel file? Thanks in advance Daniel |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Fill a Combobox from a ROW? | Excel Discussion (Misc queries) | |||
fill combobox depending on selection from another combobox | Excel Discussion (Misc queries) | |||
How do I fill a cell in a user form from a selection on same form? | Excel Discussion (Misc queries) | |||
Fill in form to type Item descrictions and costs and fill in funct | Excel Worksheet Functions | |||
Fill a combobox | Excel Programming |