ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Populating listbox from network directory (https://www.excelbanter.com/excel-programming/314618-populating-listbox-network-directory.html)

FinChase

Populating listbox from network directory
 
Is it possible to have a listbox on a userform populate with the contents
(names of workbooks) of a network directory? I know it's possible in VB, but
I can't figure out how to do this in VBA.

Thanks, Lee

Jim Rech

Populating listbox from network directory
 
An example of one way to do it:

Private Sub UserForm_Initialize()
Dim FName As String
FName = Dir("c:\files\*.xls")
While FName < ""
ListBox1.AddItem FName
FName = Dir
Wend
End Sub

--
Jim Rech
Excel MVP
"FinChase" wrote in message
...
| Is it possible to have a listbox on a userform populate with the contents
| (names of workbooks) of a network directory? I know it's possible in VB,
but
| I can't figure out how to do this in VBA.
|
| Thanks, Lee




All times are GMT +1. The time now is 10:21 AM.

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