|
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
Sub test()
Dim fu(1 To 1000)
Dim arr1(1 To 10000, 1 To 1)
Dim arr(1 To 10000, 1 To 1)
Dim f, i, j, k, f3, q
fu(1) = ThisWorkbook.Path & "\HJ\"
i = 1
k = 1
Do While i <= k
f = Dir(fu(i), vbDirectory)
Do
If InStr(f, ".") = 0 And f <> "" Then
k = k + 1
fu(k) = fu(i) & f & "\"
End If
f = Dir
Loop Until f = ""
i = i + 1
Loop
For x = 1 To UBound(fu)
If fu(x) = "" Then Exit For
f3 = Dir(fu(x) & "*.*")
Do While f3 <> ""
q = q + 1
arr1(q, 1) = fu(x) & f3
arr(q, 1) = f3
f3 = Dir
Loop
Next x
Range("a2").Resize(q) = arr
Range("b2").Resize(q) = arr1
End Sub
|
|