Best Way to Get File Names into UserForm

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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?
 
Stratuser,

give this a try:

Dim strFile As String
strFile = Dir("D:\TEMP\*.XLS")
While strFile <> ""
ListBox1.AddItem strFile
strFile = Dir
Wend
 
Many thanks, your way is a million times faster than Filesearch, and it
solves my problem.

Stratuser
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top