Function FindAllFiles(FolderPath)\x0d\x0a Dim AllFiles,fso,Folder,f,files\x0d\x0a AllFiles = ""\x0d\x0a Set fso = CreateObject("Scripting.FileSystemObject")\x0d\x0a Set Folder = fso.getfolder(FolderPath)\x0d\x0a Set files = Folder.files\x0d\x0a For Each f In files\x0d\x0a AllFiles = AllFiles & f.name & ","\x0d\x0a Next\x0d\x0a Set fso = Nothing\x0d\x0a FindAllFiles = Split(AllFiles, ",")\x0d\x0aEnd Function\x0d\x0a \x0d\x0a//下面是调用方法:\x0d\x0aFileEx = FindAllFiles(文件路径) //文件路径是字符串,要加双撇\x0d\x0aIf UBound(FileEx) > 0 Then \x0d\x0a For i = 0 To UBound(FileEx) - 1\x0d\x0a MessageBox FileEx(i)\x0d\x0a Next\x0d\x0aElse \x0d\x0a MessageBox "文件夹没有文件"\x0d\x0aEnd If
温馨提示:答案为网友推荐,仅供参考