|
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
Sub 自行测试吧()
Dim p As String, Fso As Object, ar(1 To 2345, 1 To 1) As String, n As Long
Set Fso = CreateObject("Scripting.FileSystemObject")
p = "\\caojsvr5.ad.glpoly.net\PUR_SIB\"
GetFolders p, Fso, ar, n
Range("A1").Resize(UBound(ar)) = ar
Set Fso = Nothing
End Sub
Function GetFolders(pth As String, Fso As Object, ar, n As Long)
Dim fld
For Each fld In Fso.GetFolder(pth).SubFolders
If fld.Name Like "*output*" Then
n = n + 1
ar(n, 1) = fld.Path
End If
GetFolders fld.Path, Fso, ar, n
Next
End Function |
|