VBA实现递归遍历所选中的路径,并将该路径下文件及子文件夹中所有文件路径列出在第一列,求大神帮忙。 50
1个回答
展开全部
您能提出这等 问题说明您的VBA水平有一定火候了,请看
Function Fllst(Pth$)
Dim Fso As Object
Dim Fld, Fl
Set Fso = CreateObject("Scripting.FileSystemObject")
Set Fld = Fso.getfolder(Pth)
On Error Resume Next
For Each Fl In Fld.Files
[A65536].End(3)(2) = Fl.path
Next
For Each Fl In Fld.SubFolders
Fllst (Fl.path)
Next
End Function
Sub getList()
Dim Fso As Object
Set Fso = CreateObject("Scripting.FileSystemObject")
[A:A].ClearContents
Application.ScreenUpdating = False
Fllst (CreateObject("Shell.Application").BrowseForFolder(0, "请选择目录", 0, "").Self.path)
Application.ScreenUpdating = True
Set Fso = Nothing
End Sub
Function Fllst(Pth$)
Dim Fso As Object
Dim Fld, Fl
Set Fso = CreateObject("Scripting.FileSystemObject")
Set Fld = Fso.getfolder(Pth)
On Error Resume Next
For Each Fl In Fld.Files
[A65536].End(3)(2) = Fl.path
Next
For Each Fl In Fld.SubFolders
Fllst (Fl.path)
Next
End Function
Sub getList()
Dim Fso As Object
Set Fso = CreateObject("Scripting.FileSystemObject")
[A:A].ClearContents
Application.ScreenUpdating = False
Fllst (CreateObject("Shell.Application").BrowseForFolder(0, "请选择目录", 0, "").Self.path)
Application.ScreenUpdating = True
Set Fso = Nothing
End Sub
本回答被网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询