Bonjour, l'exécution de cette macro me donne un erreur424 sur le ligne "With ClFileSearch.ClasseFileSearch
" (je travaille sur excel 2013) :
Sub chercheFichiersFermes() Dim X As Integer, nbFichiers As Integer, Y As Integer Dim Tableau() As String Dim Direction As String Application.ScreenUpdating = False Direction = dir("C:\Users\Dream\Desktop\Nouveau dossier\*.xls") 'adapter chemin repertoire et ajouter "\*.xls" pour dire tout les fichiers("C:\Users\Dream\Desktop\Nouveau dossier") Worksheets("Sheet1").Columns("D").NumberFormat = "" Do While Len(Direction) > 0 nbFichiers = nbFichiers + 1 ReDim Preserve Tableau(1 To nbFichiers) Tableau(nbFichiers) = Direction Direction = dir() Loop If nbFichiers > 0 Then For X = 1 To (nbFichiers - 1) If Tableau(X) <> ThisWorkbook.Name Then Z = Z + 1 With ActiveSheet.Cells(Z, 1) .Formula = "='C:\Users\Dream\Desktop\Nouveau dossier\[" & Tableau(X) & "]Débit" & "'!" & "K7" .Value = .Value End With With ActiveSheet.Cells(Z, 2) .Formula = "='C:\Users\Dream\Desktop\Nouveau dossier\[" & Tableau(X) & "]Débit" & "'!" & "O2" .Value = .Value End With With ActiveSheet.Cells(Z, 3) .Formula = "='C:\Users\Dream\Desktop\Nouveau dossier\[" & Tableau(X) & "]Débit" & "'!" & "D14" .Value = .Value End With With ActiveSheet.Cells(Z, 4) .Formula = "='C:\Users\Dream\Desktop\Nouveau dossier\[" & Tableau(X) & "]Moulage" & "'!" & "K16" .Value = .Value End With End If Next X End If With ClFileSearch.ClasseFileSearch .LookIn = "C:\Users\Dream\Desktop\Nouveau dossier\*.xls" 'adapter chemin repertoire et ajouter "\*.xls" pour dire tout les fichiers .SearchSubFolders = False .Filename = "*.xls" .FileType = msoFileTypeExcelWorkbooks If .Execute > 0 Then For i = 1 To .FoundFiles.Count Range("M" & i + 1).Value = .FoundFiles(i) Next i End If End With Application.ScrecenUpdating = True End Sub