![]() |
Best Way to Get File Names into UserForm
I have a userform that uses the filesearch command to get 132 filenames from
a subdirectory and put them into a listbox that I pick the filenames from. The filesearch command is way too slow --- taking 30 seconds every time --- so I'm looking for a more efficient way. Any ideas? |
Best Way to Get File Names into UserForm
Stratuser,
give this a try: Dim strFile As String strFile = Dir("D:\TEMP\*.XLS") While strFile < "" ListBox1.AddItem strFile strFile = Dir Wend -- Hope that helps. Vergel Adriano "Stratuser" wrote: I have a userform that uses the filesearch command to get 132 filenames from a subdirectory and put them into a listbox that I pick the filenames from. The filesearch command is way too slow --- taking 30 seconds every time --- so I'm looking for a more efficient way. Any ideas? |
Best Way to Get File Names into UserForm
Many thanks, your way is a million times faster than Filesearch, and it
solves my problem. Stratuser "Vergel Adriano" wrote: Stratuser, give this a try: Dim strFile As String strFile = Dir("D:\TEMP\*.XLS") While strFile < "" ListBox1.AddItem strFile strFile = Dir Wend -- Hope that helps. Vergel Adriano "Stratuser" wrote: I have a userform that uses the filesearch command to get 132 filenames from a subdirectory and put them into a listbox that I pick the filenames from. The filesearch command is way too slow --- taking 30 seconds every time --- so I'm looking for a more efficient way. Any ideas? |
All times are GMT +1. The time now is 02:35 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com