1
我正在嘗試創建一個腳本,該腳本將打開目錄中的最新文件夾。打開目錄中的最近文件夾
該文件夾的名稱每個月都會有所不同(01-Jan,02-Feb e.t.c)。下面似乎找到最新的文件夾,但我得到的錯誤文件沒有找到當我添加在殼牌「explorer.exe」&「」& strFullFldrPath,vbNormalFocus打開文件夾。
這是我到目前爲止。
Sub GetLatestFolder()
Dim fso As FileSystemObject
Dim fldrRoot As Folder
Dim SubFld As Folder
Dim strFolderName As String
Dim strFullFldrPath As String
Set fso = New FileSystemObject
Set fldrRoot = fso.GetFolder("\\Hbeu.adroot.hsbc\dfsroot\GB002\RRU\DTCC EU Reports\ETD\")
For Each SubFld In fldrRoot.SubFolders
strFolderName = SubFld.Name
strFullFldrPath = fldrRoot & "\" & SubFld.Name
Shell "explorer.exe" & "" & strFullFldrPath, vbNormalFocus
Exit For
Next SubFld
End Sub