Hi everyone - I found this great code below that extracts the file names for all files in my folder. I was wondering if anyone knows how to also add the: "file path"; "file size"; "last modified date"; and "last modified by".
Please let me know if you have any thoughts!
Please let me know if you have any thoughts!
Code:
Sub Auto_Open()
Dim FileSystem As Object
Dim HostFolder As String
HostFolder = "C:\Users\e314704\Desktop\LCST Gain Share\Reports"
Set FileSystem = CreateObject("Scripting.FileSystemObject")
DoFolder FileSystem.getFolder(HostFolder)
End Sub
Sub DoFolder(Folder)
Dim SubFolder
For Each SubFolder In Folder.SubFolders
DoFolder SubFolder
Next
i = Sheets("File Extraction").Cells(Rows.Count, 1).End(xlUp).Row + 2
Dim File
For Each File In Folder.Files
Sheets("File Extraction").Hyperlinks.Add Anchor:=Cells(i, 1), Address:= _
File.Path, TextToDisplay:=File.Name
i = i + 1
Next
End Sub