Displaying a list of files in a directory : FileDateTime « File Path « VBA / Excel / Access / Word






Displaying a list of files in a directory

 
Sub ListFiles2()
    
    With Application.fileSearch
        .NewSearch
        .LookIn = "c:\windows\desktop\"
        .FileName = "*.*"
        .SearchSubFolders = False
        .Execute
        For i = 1 To .FoundFiles.Count
            Debug.Print .FoundFiles(i)
            Debug.Print FileLen(.FoundFiles(i))
            Debug.Print FileDateTime(.FoundFiles(i))
        Next i
    End With
End Sub

 








Related examples in the same category

1.Retrieve Date and Time of Last Save
2.FormatDateTime(Now, vbShortDate)
3.FormatDateTime(Now, vbLongDate)
4.FormatDateTime(Now, vbGeneralDate)