怎样用vba取得子文件夹一览

2024-12-04 18:48:06
推荐回答(1个)
回答1:

用DIR这个函数来列出某个文件夹下的内容,
以excel里的为例

Dim i As Integer
i = 1
Sheet1.Range("A" & i) = Dir("C:\")
Do While True
i = i + 1
Sheet1.Range("A" & i) = Dir
If Sheet1.Range("A" & i) = "" Then Exit Do

Loop