ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Fill ComboBox with File Names (https://www.excelbanter.com/excel-programming/339446-fill-combobox-file-names.html)

Hal

Fill ComboBox with File Names
 
Hello All,

Simple question for you real programmers. (Complicated for this amature.)

I have an excel file that I need to fill a combo box on a form with the name
of XLS files. O'reilly doesn't give me much insight on how to do this.
Basically I'll show a form at the time "file.xls" is loaded. The combo box
needs to be filled with xls files from the Application.ActiveWorkbook.Path
and its subdirectories.

Thanks in advance.

Hal

Charlie

Fill ComboBox with File Names
 
You can put this in:

Private Sub UserForm_Activate()

Dim fname As String

fname = Dir("*.xls")
Do While fname < ""
ComboBox1.AddItem fname
fname = Dir
Loop

End Sub

"Hal" wrote:

Hello All,

Simple question for you real programmers. (Complicated for this amature.)

I have an excel file that I need to fill a combo box on a form with the name
of XLS files. O'reilly doesn't give me much insight on how to do this.
Basically I'll show a form at the time "file.xls" is loaded. The combo box
needs to be filled with xls files from the Application.ActiveWorkbook.Path
and its subdirectories.

Thanks in advance.

Hal



All times are GMT +1. The time now is 03:32 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com