Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
GFN GFN is offline
external usenet poster
 
Posts: 8
Default make a list of files in a directory

Is there a way for excel to list the files in a directory including
subdirectories.


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 226
Default make a list of files in a directory

from Excel help

Set fs = Application.FileSearch
With fs
.LookIn = "C:\Documents and Settings\rdrummon\Desktop"
.SearchSubFolders = True
.Filename = "cmd*"
If .Execute() 0 Then
MsgBox "There were " & .FoundFiles.Count & _
" file(s) found."
For i = 1 To .FoundFiles.Count
MsgBox .FoundFiles(i)
Next i
Else
MsgBox "There were no files found."
End If
End With

this example searches for all files starting with cmd, take out the line
..Filename = "cmd*"
to search for all files.

Hope this helps
Rowan


"GFN" wrote:

Is there a way for excel to list the files in a directory including
subdirectories.


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default make a list of files in a directory


Sub ListFiles02(FileDir)

'Using FileSearch to list the files in a directory

Dim i As Integer

i = 1

With Application.FileSearch

NewSearch
LookIn = FileDir
FileName = "*.*"
SearchFolders = False
Execute

For i = 1 To .FoundFiles.Count

Range("A" & i).Value = .FoundFiles(i)
Range("B" & i).Value = FileLen(.FoundFiles(i))
Range("C" & i).Value = FileDateTime(.FoundFiles(i))

Next

End With

End Sub


--
Kaak
------------------------------------------------------------------------
Kaak's Profile: http://www.excelforum.com/member.php...fo&userid=7513
View this thread: http://www.excelforum.com/showthread...hreadid=391205

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
is there a add-on for excel to make mp3 list from directory Ellard Excel Discussion (Misc queries) 3 December 12th 06 02:44 AM
Combo box with list of xls files in a directory excelguy Excel Discussion (Misc queries) 0 November 27th 06 02:53 PM
List of Files in A Directory JaneC Excel Discussion (Misc queries) 2 February 18th 06 12:11 PM
Directory List of Excel Files No Name Excel Programming 6 May 18th 04 05:22 PM
list box- list all files ina directory suee Excel Programming 9 April 7th 04 02:32 AM


All times are GMT +1. The time now is 02:25 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"