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
|
'///////////////////////////////////////////////
'/// Nécessite la Library Shell32 ///
'/// Microsoft Shell Controls And Automation ///
'/// C:\WINDOWS\system32\SHELL32.dll ///
'///////////////////////////////////////////////
'### Constante du dossier et son chemin à adapter ###
Const MON_DOSSIER = "C:\A.zip"
'####################################################
Sub PropertiesFile()
Dim ShellApp As Shell32.Shell
Dim Fichier As Shell32.FolderItem
Dim Dossier As Shell32.Folder
Dim i&
Dim j&
Dim T()
Dim S As Worksheet
Dim R As Range
Set ShellApp = CreateObject("Shell.Application")
Set Dossier = ShellApp.Namespace(MON_DOSSIER)
ReDim T(1 To Dossier.Items.Count + 1, -1 To 34)
For Each Fichier In Dossier.Items
i& = i& + 1
If i& = 1 Then
For j& = -1 To 34
T(i&, j&) = "#" & j& & " " & Dossier.GetDetailsOf(Dossier.Items, j&)
Next j&
End If
For j& = -1 To 34
T(i& + 1, j&) = Dossier.GetDetailsOf(Fichier, j&)
Next j&
Next Fichier
Set S = Sheets.Add
Set R = S.Range(S.Cells(1, 1), S.Cells(UBound(T, 1), UBound(T, 2) + 2))
R = T
With S.Range(S.Cells(1, 1), S.Cells(1, UBound(T, 2) + 2))
.Font.Bold = True
.HorizontalAlignment = xlCenter
.Interior.ColorIndex = 34
End With
S.Columns.AutoFit
Set ShellApp = Nothing
End Sub |
Partager