Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 110
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 110
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Fill a Combobox from a ROW? Rob[_5_] Excel Discussion (Misc queries) 4 January 15th 09 08:12 PM
fill combobox depending on selection from another combobox Adam Francis Excel Discussion (Misc queries) 2 July 24th 08 07:39 PM
How do I fill a cell in a user form from a selection on same form? Terry Tipsy Excel Discussion (Misc queries) 4 June 11th 07 02:59 PM
Fill in form to type Item descrictions and costs and fill in funct cradino Excel Worksheet Functions 0 July 16th 06 08:44 PM
Fill a combobox karibou Excel Programming 2 January 27th 04 04:13 PM


All times are GMT +1. The time now is 07:39 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"