Use macro below - just remainder anything in active sheet in the first 4 columns ( A-D) will be deleted before new data is added
Private Sub Workbook_Open()
Dim xFSO As Object
Dim xFolder As Object
Dim xFile As Object
Dim xPath As String
Dim i As Long
ActiveSheet.Range(Cells(1, 1), Cells(Rows.Count, 4)).ClearContents
ActiveSheet.Range(Cells(1, 1), Cells(Rows.Count, 4)).ClearFormats
xPath = "C:\Users\xxxx\Desktop\New folder"
Set xFSO = CreateObject("Scripting.FileSystemObject")
Set xFolder = xFSO.GetFolder(xPath)
For Each xFile In xFolder.Files
i = i + 1
ActiveSheet.Hyperlinks.Add Cells(i + 1, 1), xFile.Path, , , xFile.Name
ActiveSheet.Cells(i + 1, 2).Value = xFile.DateLastModified
ActiveSheet.Cells(i + 1, 3).Value = xFile.DateCreated
ActiveSheet.Cells(i + 1, 4).Value = xFile.DateLastAccessed
Next
With CreateObject("scripting.filesystemobject")
For Each xFolder In .GetFolder(xPath).SubFolders
ActiveSheet.Hyperlinks.Add Anchor:=Cells(i + 3, 1), _
Address:=xPath & Application.PathSeparator & xFolder.Name, _
TextToDisplay:=xFolder.Name
Cells(i + 3, 1).Font.Bold = True
Cells(i + 3, 1).Interior.ColorIndex = 8
ActiveSheet.Cells(i + 3, 2).Value = xFolder.DateLastModified
ActiveSheet.Cells(i + 3, 3).Value = xFolder.DateCreated
ActiveSheet.Cells(i + 3, 4).Value = xFolder.DateLastAccessed
i = i + 1
Next
End With
Range("A1").FormulaR1C1 = "Name"
Range("B1").FormulaR1C1 = "DateLastModified"
Range("C1").FormulaR1C1 = "DateCreated"
Range("D1").FormulaR1C1 = "DateLastAccessed"
Columns("A:D").EntireColumn.AutoFit
End Sub
Bookmarks