我有一个返回文件名、大小、路径和日期的代码片段。如何放置 if 语句以便显示大于 X 的日期?
Dim irow
Sub ListFiles()
irow = 11
Call ListMyFiles(Range("C7"), Range("C8"))
End Sub
Sub ListMyFiles(mySourcePath, IncludeSubfolders)
Set MyObject = New Scripting.FileSystemObject
Set mySource = MyObject.GetFolder(mySourcePath)
On Error Resume Next
For Each myFile In mySource.Files
iCol = 2
Cells(irow, iCol).Value = myFile.Path
iCol = iCol + 1
Cells(irow, iCol).Value = myFile.Name
iCol = iCol + 1
Cells(irow, iCol).Value = myFile.Size
iCol = iCol + 1
Cells(irow, iCol).Value = myFile.DateLastModified
irow = irow + 1
Next
If IncludeSubfolders Then
For Each mySubFolder In mySource.SubFolders
Call ListMyFiles(mySubFolder.Path, True)
Next
End If
End Sub