PDA

View Full Version : How to fill all filenames into array without for-next or do-loop...



domfootwear
01-23-2011, 08:33 PM
Can you help me the way to fill all filenames into array (Not ussing for-next or do-loop...) ?
Thanks in advance

Dave
01-23-2011, 09:31 PM
Load an array with VBA without a loop? Select Case or perhaps DIR. Dave

domfootwear
01-23-2011, 09:37 PM
Load an array with VBA without a loop? Select Case or perhaps DIR. Dave

Yes, Load an array with VBA without a loop.
Thanks for your reply !

Bob Phillips
01-24-2011, 01:13 AM
That is not a functional requirement, so why do you require that?

Kenneth Hobs
01-24-2011, 06:20 AM
Your question is vague. For instance, if you mean all filenames from the c:\ drive, that could be huge. Filenames can be in subfolders so you have to consider that as well. Filenames to an array from a filled listbox control or a Range is easily done without loops. In general, as commented, limiting the method, limits the solutions.

There is an API method that can fill a combobox or listbox control with filenames. I don't remember if it has a loop in it or not. Once the names are in the control, you can put them into an array without looping if needed.

mdmackillop
01-24-2011, 04:15 PM
I you are using Excel 2003 or earlier, you could use FileSearch to create the array FoundFiles (see VBA Help)