1

我想真的很简单的问题。我如何修改以下内容,而不是查看 LOI.CSV,而是查看盘中文件夹中的所有 .CSV 文件?

LastSaved = FileDateTime("W:\Settlements\Intraday\LOT.csv")

If LastSaved < Date Then
  MsgBox ("The current day file for LOI was last saved " & LastSaved)
End If
4

1 回答 1

3

尝试这个

Const sPath As String = "W:\Settlements\Intraday\"

Sub LoopThroughFilesInAFolder()
    Dim StrFile As String

    StrFile = Dir(sPath & "\*.Csv")

    Do While Len(StrFile) > 0
        Debug.Print FileDateTime(sPath & "\" & StrFile)
        '~~> Rest of the code here
        StrFile = Dir
    Loop
End Sub
于 2012-07-13T13:12:59.427 回答