drdrfaulkner
New Member
- Joined
- Oct 15, 2002
- Messages
- 5
I have a folder in Windows Explorer containing numerous files I want to list in a spreadsheet without cutting and pasting them individually. Is there a way I can do this?
Sub Test()
Dim i As Long
With Application.FileSearch
.NewSearch
' *** Change Folder name to suit ***
.LookIn = "C:My Documents"
.SearchSubFolders = False
.Filename = "*.*"
If .Execute > 0 Then
For i = 1 To .FoundFiles.Count
Cells(1, 1).Value = .FoundFiles(i)
Next i
End If
End With
End Sub