A
ac1179
Can someone help me create a macro that lists excel files in a folder
and also gets the date the file was created and last modified?
I found this macro on the web, but it just gets the filenames:
Public Sub ListWorkbooks()
Dim Directory As String
Dim FileName As String
Dim IndexSheet As Worksheet
Dim rw As Long
'Change the directory below as needed
Directory = "R:\07\"
If Left(Directory, 1) <> "\" Then
Directory = Directory & "\"
End If
rw = 1
Set IndexSheet = ThisWorkbook.ActiveSheet
FileName = Dir(Directory & "*.xls")
Do While FileName <> ""
IndexSheet.Cells(rw, 1).Value = FileName
rw = rw + 1
FileName = Dir
Loop
Set IndexSheet = Nothing
End Sub
and also gets the date the file was created and last modified?
I found this macro on the web, but it just gets the filenames:
Public Sub ListWorkbooks()
Dim Directory As String
Dim FileName As String
Dim IndexSheet As Worksheet
Dim rw As Long
'Change the directory below as needed
Directory = "R:\07\"
If Left(Directory, 1) <> "\" Then
Directory = Directory & "\"
End If
rw = 1
Set IndexSheet = ThisWorkbook.ActiveSheet
FileName = Dir(Directory & "*.xls")
Do While FileName <> ""
IndexSheet.Cells(rw, 1).Value = FileName
rw = rw + 1
FileName = Dir
Loop
Set IndexSheet = Nothing
End Sub