求助
VB中怎样获取D:\qazwsx\文件夹下,最新的.csv文件并获取它的名字(最好不APl) --------------------编程问答-------------------- 工程中引用 ms scripting runtimePrivate Sub Command1_Click()
Dim fso As New Scripting.FileSystemObject
Dim p As Scripting.Folder
Dim f As Scripting.File
Dim i As Long
Dim dPrev As Date
Dim TheFile As String
TDlg.ShowOpen
Set p = fso.GetFolder(fso.GetParentFolderName(TDlg.FileName))
If Not p Is Nothing Then
For Each f In p.Files
If UCase(fso.GetExtensionName(f.Path)) = "CSV" Then
If f.DateLastModified > dPrev Then
dPrev = f.DateLastModified
TheFile = f.Name
End If
End If
Next
Debug.Print TheFile, dPrev
End If
End Sub
补充:VB , API