1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57
| Option Explicit
Dim Path,DSO
Set DSO = CreateObject("DSOFile.OleDocumentProperties")
Path=inputbox("Entrez le chemin du repertoire a Analyser","Analyse JLW")
MsgBox ShowFolderList(Path),,"Liste des fichiers du répertoire """ & Path
Function ShowFolderList(strPath)
Dim fso, Dossiers, fic, fichiers, strListe, f, r
Dim Valeur, imax, z, Cible, liste, Ftxt
Dim oSummProps
Set fso = CreateObject("Scripting.FileSystemObject")
Set Dossiers = fso.GetFolder(Path)
Set fic = Dossiers.Files
imax = 0
For Each fichiers In fic
Set f = fso.GetFile(fichiers)
imax = imax + 1
ReDim Preserve Tableau(2, imax)
Tableau(1, imax) = f.Name
Tableau(2, imax) = f.Type
DSO.Open Path & "\" & f.Name, True 'ouverture fichier en ro
If DSO.IsOleFile Then
Set oSummProps=DSO.SummaryProperties 'récupération des propriétés
Tableau(0, imax) = oSummProps.Template 'bingo...
Else
Tableau(0, imax) = "néant"
End If
DSO.Close
Valeur = 0
For imax = 1 To imax - 1
For z = 0 To 2
Cible = Tableau(z, imax)
Tableau(z, imax) = Tableau(z, imax + 1)
Tableau(z, imax + 1) = Cible
Next
Valeur = 1
Next
Next
For r = 1 To imax
liste = liste & vbCrLf & r & " " & Tableau(1, r) & " " & Tableau(2, r) & " " & Tableau(0, r)
Next
liste = vbCrLf& "N° Nom du fichier Type Modèle" &vbCrLf& liste
ShowFolderList = liste
Set Ftxt = FSO.createTextFile(".\repertoire\liste.txt",true)
Ftxt.writeline (liste)
Ftxt.Close
End Function |
Partager