vba遍历指定的文件夹
Sub filelist() Dim MyName, Dic, Did, i, t, F, TT, MyFileName 'On Error Resume Next Set objShell = CreateObject("Shell.Application") Set objFolder = objShell.BrowseForFolder(0, "选择文件夹", 0, 0) If Not objFolder Is Nothing Then lj = objFolder.self.Path & "\" Set objFolder = Nothing Set objShell = Nothing t = Time Set Dic = CreateObject("Scripting.Dictionary") '创建一个字典对象 Set Did = CreateObject("Scripting.Dictionary") Dic.Add (lj), "" i = 0 Do While i < Dic.Count Ke = Dic.keys '开始遍历字典 MyName = Dir(Ke(i), vbDirectory) '查找目录 Do While MyName <> "" If MyName <> "." And MyName <> ".." Then If (GetAttr(Ke