View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Mark Philpot Mark Philpot is offline
external usenet poster
 
Posts: 1
Default Folder and filenames?

Hi,
Thanks for the reply, I will try it out but basically,
there can be no userintervention except to say "go". See
my reponse to Bob Phillips.

regards
mark
-----Original Message-----
Hi Mark
Application.FileSearch will also do the job but partially:
With Application.FileSearch
..NewSearch
..LookIn = "E:\Customers"
..SearchSubFolders = True
..FileType = msoFileTypeAllFiles 'see choice in list
If .Execute() 0 Then
Worksheets("Sheet1").Cells(1, 1).Value = "File Name"
For i = 2 To .FoundFiles.Count
Worksheets("Sheet1").Cells(i, 1).Value = .FoundFiles

(i)
Next i
Else
MsgBox "No files where found in the specified

folder", vbInformation,
"No Match"
End If
End With

HTH
Cordially
Pascal


"Mark" a écrit dans le

message de
...
I want to list (from a known directory eg: E:\Customers)
the folder names (that branch off the Customers folder)
into sheet1 and filenames in each folder into sheet2.

Can
this be done with VBA or do I need to resort to an API
call?
If anyone knows or has an idea, let me know here and at

my
email:


Alternatively,
In vb6 there is a control that lists all the files in a
given directory, in a listbox. Is there a similar

control
in excel?

Could I use this control in excel? I've got it but

haven't
tried it yet.

regards
Mark




.