代码如下:
Function ShowFolderList(folderName As String)
'folderName 文件夹名称
Dim fso, f, f1, fc, dt
Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso.GetFolder(folderName)
Set fc = f.Files
For Each f1 In fc '在文件夹中遍及所有文件
'dt = f1.DateCreated '建日期和时间
'dt = f1.DateLastAccessed '上次访问日期和时间
dt = f1.DateLastModified '上次修改日期和时间
Debug.Print f1.Name & " " & dt
Next
Set fso = Nothing
End Function