Trial 2....
Option Explicit
Sub listallfiles()
Dim objfso As Object, objfolder As Object
Set objfso = CreateObject("scripting.filesystemobject")
Set objfolder = objfso.GetFolder("C:\YourFolderName")
Call getfiledetails(objfolder)
Set objfolder = Nothing
Set objfso = Nothing
End Sub
Function getfiledetails(objfolder As Object)
Dim objfile As Object, nextrow As Long, objsubfolder As Object
With Sheets("sheet1")
nextrow = .Cells(.Rows.Count, 1).End(xlUp).Row + 1
For Each objfile In objfolder.Files
.Cells(nextrow, 1) = objfile.Name
.Cells(nextrow, 5) = objfile.DateCreated
nextrow = nextrow + 1
Next
End With
For Each objsubfolder In objfolder.SubFolders
Call getfiledetails(objsubfolder)
Next
Set objsubfolder = Nothing
Set objfile = Nothing
End Function
Dave