1 Option Explicit 2 Dim i 3 Function sda(path) 4 Dim fso 5 Dim f 6 Dim s 7 Dim ff 8 Set fso = CreateObject("scripting.filesystemobject") 9 Set f = fso.getfolder(path) 10 For Each s In f.Files 11 i = i + 1 12 Range("A" & i) = path & "\" & s.Name 13 Next 14 15 For Each ff In f.subfolders 16 Call sda(ff) 17 Next 18 Set ff = Nothing 19 Set fso = Nothing 20 End Function 21 22 Sub dddd() 23 Dim path As String 24 path = "C:\Users\lison\Desktop\新建文件夹" 25 sda (path) 26 End Sub
标签:Dim,Set,及子,fso,文件夹,ff,path,filesystemobject From: https://www.cnblogs.com/lisongmei/p/17581854.html