Hello,
Below is a code that allows me to open one by one the workbooks contained in a folder and to print the sheets mentioned on a master workbook.
I'm annoyed because the default settings of the workbook get the upper hand on the macro settings. thus, the files are printed in black and white if the file was saved in black and white and in color if it was saved in color.
Below is a code that allows me to open one by one the workbooks contained in a folder and to print the sheets mentioned on a master workbook.
I'm annoyed because the default settings of the workbook get the upper hand on the macro settings. thus, the files are printed in black and white if the file was saved in black and white and in color if it was saved in color.
Rich (BB code):
Sub impression_GCU()
Dim oFSO As Object
Dim oDossier As Object
Dim oFichier As Object
Dim i As Integer
Dim wb As Workbook
Application.ScreenUpdating = False
Set oFSO = CreateObject("Scripting.FileSystemObject")
Set oDossier = oFSO.GetFolder(ThisWorkbook.Worksheets("IMPRESSION").Range("B5").Value & "\")
For Each oFichier In oDossier.Files
' Ouvrir chaque classeur contenu dans le dossier
Set wb = Workbooks.Open(Filename:=oFichier)
' Définir les pages à imprimer et les propriétés d'impression
'Imprimer la feuille PCP A3H
With ActiveWorkbook.Worksheets("PCP A3H")
.PageSetup.BlackAndWhite = False
.PageSetup.Orientation = xlLandscape
.PageSetup.PaperSize = xlPaperA3
.PrintOut From:=1, To:=1, copies:=1
End With
'Imprimer la feuille Métrologie Saisie Manuscrite
With ActiveWorkbook.Worksheets("Métrologie Saisie Manuscrite")
.PageSetup.BlackAndWhite = False
.PageSetup.Orientation = xlLandscape
.PageSetup.PaperSize = xlPaperA4
.PrintOut copies:=5
End With
' Fermer le classeur et passer au suivant
wb.Close savechanges = False
Next oFichier
Application.ScreenUpdating = True
End Sub