PC Review


Reply
Thread Tools Rate Thread

Best Way to Get File Names into UserForm

 
 
=?Utf-8?B?U3RyYXR1c2Vy?=
Guest
Posts: n/a
 
      30th Apr 2007
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?
 
Reply With Quote
 
 
 
 
=?Utf-8?B?VmVyZ2VsIEFkcmlhbm8=?=
Guest
Posts: n/a
 
      30th Apr 2007
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?

 
Reply With Quote
 
=?Utf-8?B?U3RyYXR1c2Vy?=
Guest
Posts: n/a
 
      30th Apr 2007
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?

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Populate Listbox on Userform with file names OM Microsoft Excel Programming 1 21st Jul 2010 05:48 PM
Add Tab names to Userform SLW612 Microsoft Excel Programming 2 14th Feb 2008 10:48 PM
Control names on userform =?Utf-8?B?WmFyY2g=?= Microsoft Excel Programming 3 8th Nov 2007 05:56 PM
Listing Userform Names =?Utf-8?B?TmlnZWwgUlM=?= Microsoft Excel Programming 9 12th Oct 2006 07:38 AM
File Names: List Long file Names from Database List of short file names Ben Microsoft VB .NET 4 6th May 2006 01:20 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:53 AM.