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
| Sub LireInfosDureeAVI()
'Dans outil réferences cocher Microsoft Shell Controls and Automation
Dim Chemin As String, myShell As Shell, myFolder As Folder, myFile As FolderItem, i As Long, f As String, lig As Long
ReDim tablo(Rows.Count, 2)' redim permet de pouvoir le redimentionner par la suite avec "dim c'est fixe
[a:b].Clear
duree = Timer
Chemin = "D:\FILM TV\" '*** modififer le chemin du répertoire
Set myShell = CreateObject("Shell.Application")
Set myFolder = myShell.Namespace(Chemin)
tablo(0, 0) = myFolder.GetDetailsOf("", i)
tablo(0, 1) = myFolder.GetDetailsOf("", 27)
lig = Cells(Rows.Count, 1).End(xlUp).Row
f = Dir(Chemin & "\*.avi") '***modifier l'extension ici
Do While Len(f) > 0
lig = lig + 1
Set myFile = myFolder.Items.Item(f)
tablo(lig, 0) = myFolder.GetDetailsOf(myFile, 0)
tablo(lig, 1) = IIf(myFolder.GetDetailsOf(myFile, 27) = "", "non Disponible", myFolder.GetDetailsOf(myFile, 27))' facultatif mais ca permet de voir si c'est la props qui est vide ou le principe qui a boguer
f = Dir
Loop
ReDim preservetablo(0 To lig, 0 To 2)' on garde que les pleins
Set myShell = Nothing
Set myFolder = Nothing
Set myFile = Nothing
Debug.Print Timer - duree
Cells(1, 1).Resize(lig, 2) = (tablo)
End Sub |
Partager