Displaying FileSize

  • Thread starter Thread starter Dennis
  • Start date Start date
D

Dennis

I'm able to list all file on my drive with ...

Sub MyFiles()

With Application.FileSearch

.LookIn = "C:\"
.FileType = msoFileTypeAllFiles
.SearchSubFolders = True
.Execute

End With

cnt = Application.FileSearch.FoundFiles.Count

For i = 1 To cnt

rng = "A" & i

Range(rng).Value = Application.FileSearch.FoundFiles.Item(i)

Next i

End Sub

I would also like to display the file size after each file, preferable 10
cells to the right of the file name.

TIA,
Dennis
===================
 
Try:

Range(rng).Offset(, 10).Value =
FileLen(Application.FileSearch.FoundFiles.Item(i))
 
Back
Top