ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Populate listBox (https://www.excelbanter.com/excel-programming/277239-populate-listbox.html)

Hamster

Populate listBox
 
Hi All

How do I go about populating a listbox. with file names from a directory. I
can do this in VB but can't find anything in excel


thank you
Phill



Tom Ogilvy

Populate listBox
 
Dim sPath as String
Dim sFname as String
sPath = "C:\Myfolder\*.xls"
sFname = Dir(sPath)
Do while sFname < ""
Listbox1.AddItem sFname
sFName = dir()
Loop

--
Regards,
Tom Ogilvy

"Hamster" wrote in message
...
Hi All

How do I go about populating a listbox. with file names from a directory.

I
can do this in VB but can't find anything in excel


thank you
Phill






All times are GMT +1. The time now is 11:06 PM.

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