Hi I have a Macro which will list file names in column A, but it does not include the sub folders. Can someone please help me to edit this macro to include sub folders as well. I also want to display the file path in the column C for ech document displayed in the column A
HTML:
Sub ListFiles()
Dim objFSO As FileSystemObject
Dim objFol As Folder
Dim objFiles As Files
Dim objFile As File
Range("A2:A300").Clear
Set objFSO = New Scripting.FileSystemObject
Set objFol = objFSO.GetFolder("c:\test")
Set objFiles = objFol.Files
Range("A2").Select
For Each objFile In objFiles
ActiveCell = objFile.Name
ActiveCell.Offset(1, 0).Select
DoEvents
Next
Columns("A:A").EntireColumn.AutoFit
Set objFSO = Nothing
Set objFol = Nothing
Set objFiles = Nothing
End Sub