Sub PrintFiles()
Dim i As Integer
Dim fs As FileSearch
Set fs = Application.FileSearch
Application.ScreenUpdating = False
With fs
.NewSearch
.LookIn = Me.TxbBrowseForFolder.Value
.SearchSubFolders = True
.FileType = msoFileTypeExcelWorkbooks
.Execute msoSortByFileName, msoSortOrderAscending
If .Execute > 1 Then
For i = 1 To .FoundFiles.Count
Workbooks.Open .FoundFiles(i)
Application.DisplayAlerts = False
For Each sh In Sheets
If sh.Name = "MACRO" Or sh.Name = "Feuil1" Then
sh.Delete
End If
Next sh
'If ActiveWorkbook.Name = "12 - Energie.xls" Then
'ActiveSheet.PrintOut copies:=1, collate:=True
'Else
' Sheets.PrintOut copies:=1, collate:=True
'End If
ActiveWorkbook.Close False
Next i
Else
MsgBox "Pas de fichier(s) trouvé(s)"
End If
End With
Application.ScreenUpdating = True
Unload UserForm2
End Sub