View Single Post
  #3   Report Post  
Bernie Deitrick
 
Posts: n/a
Default

Paul,

You could run a macro, like the one below. This will prompt you to select a file within the folder
of interest, and then list the file, date, and file size for all files found in the folder.

HTH,
Bernie
MS Excel MVP

Sub ListFolderContents()
Dim i As Integer
Dim myName As String
With Application.FileSearch
.NewSearch
myName = Application.GetOpenFilename( _
Title:="Pick a file in your folder")
.LookIn = Left(myName, InStrRev(myName, "\"))
.SearchSubFolders = False
.MatchTextExactly = False
.FileType = msoFileTypeAllFiles
If .Execute() 0 Then
MsgBox "There were " & .FoundFiles.Count & " file(s) found."
For i = 1 To .FoundFiles.Count
Cells(i, 1).Value = .FoundFiles(i)
Cells(i, 2).Value = FileDateTime(.FoundFiles(i))
Cells(i, 3).Value = FileLen(.FoundFiles(i))
Next i
Range("A:C").EntireColumn.AutoFit
Else
MsgBox "There were no files found."
End If
End With
End Sub



"Pablo" wrote in message
...
Is there a way to list the names of files within a directory in a worksheet?
I have a directory that contains 800 files and I would like to list them
within a Excel worksheet. I have tried selecting all, copy and paste but
nothing happens.

Any help is greatly appreciated.

Thanks,
Paul