MsgBox FnShowFolderList("F:", Date, strList) Function FnShowFolderList(argPath, argDate, strList) Dim objFso, objSubFolderItem, objSubFileItem Set objFso = CreateObject("Scripting.FileSystemObject") If Not objFso.FolderExists(argPath) Then Exit Function For Each objSubFolderItem In objFso.GetFolder(argPath).SubFolders If DateValue(objSubFolderItem.DateCreated) = argDate Then strList = strList & vbCrLf & objSubFolderItem.Path & _ Space(3) & objSubFolderItem.Files.Count End If FnShowFolderList objSubFolderItem.Path, argDate, strList Next Set objFso = Nothing FnShowFolderList = strList End Function
Option Explicit Const MyFile = "D:\Test.txt" Dim objFso, objTextFile Set objFso = CreateObject("Scripting.FileSystemObject") Set objTextFile = objFso.CreateTextFile(MyFile, True) Call FnShowFolderList("F:", Date) objTextFile.Close Set objTextFile = Nothing Set objFso = Nothing '################################################ Function FnShowFolderList(argPath, argDate) Dim objSubFolderItem If Not objFso.FolderExists(argPath) Then Exit Function For Each objSubFolderItem In objFso.GetFolder(argPath).SubFolders If DateValue(objSubFolderItem.DateCreated) = argDate Then objTextFile.Write objSubFolderItem.Path & Chr(58) & Space(1) &_ objSubFolderItem.Files.Count & vbcrlf End If FnShowFolderList objSubFolderItem.Path, argDate Next End Function
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre questionDim NumFile NumFile=FreeFile Open "Nomdufichier.ext" For Append as#NumFile Print #NumFile,"Hornel LAMA" Close#NumFile