VB打开文件夹(c:\a)的最后一个文件
文件名未知
请给出源码 谢谢!
VB打开文件夹(c:\a)的最后一个文件
文件名未知
请给出源码 谢谢!
Dim v() As String
Private Sub Form_Click()
v = Split(AllFiles("F:\VB练习\msvbvm60"), ",")
Print v(UBound(v) - 1)
End Sub
Function AllFiles(dirPath)
On Error Resume Next
If Right(dirPath, 1) <> "\" Then
dirPath = dirPath & "\"
End If
Set FSO = CreateObject("scripting.filesystemobject")
Set F = FSO.GetFolder(dirPath)
Set fs = F.Files
For Each fileN In fs
AllFiles = AllFiles & fileN.Name & ", "
Next
Set FSO = Nothing
v = Split(AllFiles, ",")
End Function