|
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
你如果一定要在数组中去掉的话就把2个循环拆开
- Sub FilPaht()
- Dim my$, arr(), mypaths$, brr()
- my = ThisWorkbook.PatH & "" '我这里是指定的当前工作簿的路径。
- mypaths = Dir(my, vbDirectory)
- Do While mypaths <> ""
- If mypaths <> "." And mypaths <> ".." And mypaths <> ThisWorkbook.Name Then
- n = n + 1
- ReDim Preserve arr(1 To n)
- arr(n) = my & mypaths & ""
- End If
- mypaths = Dir
- Loop
- i = 1
- n = 0
- Do While i <= UBound(arr)
- mypaths = Dir(arr(i), vbDirectory)
- Do While mypaths <> ""
- If mypaths <> "." And mypaths <> ".." Then
- n = n + 1
- ReDim Preserve brr(1 To n)
- brr(n) = arr(i) & mypaths & ""
- End If
- mypaths = Dir
- Loop
- i = i + 1
- Loop
- End Sub
复制代码 |
评分
-
1
查看全部评分
-
|