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 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74
| Sub Selfichierpatapon()
Dim fd As FileDialog
Set fd = Application.FileDialog(msoFileDialogFilePicker)
Dim vrtSelectedItem As Variant
Dim iRow As Long
With fd
.AllowMultiSelect = True
If .Show = -1 Then
If Not bNotFirstTime Then
Set wksDest = ActiveSheet ' A adapter
'Set FSO = CreateObject("Scripting.FileSystemObject")
With wksDest
.Cells(1, 1) = "Nom sans extension"
.Cells(1, 2) = "Durée"
.Cells(1, 3) = "Date Cré"
End With
iRow = 2
bNotFirstTime = True
End If
For Each vrtSelectedItem In .SelectedItems
Dim sFichier As String
Dim FSO As Object
Dim oFichier As Object
Dim objShell As Shell32.Shell
Dim objFolder As Shell32.Folder
Dim strFileName As Shell32.FolderItem
Dim Chemin As String, sNomFich As String
Set FSO = CreateObject("Scripting.FileSystemObject")
Set oFichier = FSO.GetFile(vrtSelectedItem)
Chemin = FSO.GetParentFolderName(oFichier)
sNomFich = FSO.GetFileName(oFichier)
Set objShell = CreateObject("Shell.Application")
Set objFolder = objShell.Namespace(Chemin)
Set strFileName = objFolder.Items.Item(sNomFich)
If strFileName.IsFolder = False Then
If objFolder.GetDetailsOf(objFolder.Items, i) <> "" Then
With ActiveSheet
.Cells(iRow, 1) = Left(objFolder.GetDetailsOf(strFileName, 0), InStr(objFolder.GetDetailsOf(strFileName, 0), ".") - 1)
.Cells(iRow, 2) = objFolder.GetDetailsOf(strFileName, 27)
.Cells(iRow, 3) = objFolder.GetDetailsOf(strFileName, 4)
End With
End If
End If
iRow = iRow + 1
' MsgBox "valeur de iRow: " & iRow
Next vrtSelectedItem
Else
End If
End With
Set strFileName = Nothing
Set objFolder = Nothing
Set objShell = Nothing
Set oFichier = Nothing
Set FSO = Nothing
end sub |
Partager