Private Sub CommandButton2_Click()
'MACRO IMPRESSION PAYSAGE
'------------------------
Dim Ws As Worksheet
Dim MonNom As String
'Copie d'écran de la forme active
keybd_event vbKeySnapshot, 1, 0&, 0&
DoEvents
'Ajoute une feuille pour coller l'image de la forme
Set Ws = Sheets.Add
MonNom = ActiveSheet.Name
Ws.PageSetup.Orientation = xlLandscape
Ws.Paste
'impression centrée dans la page
With Ws.PageSetup
.PrintArea = "$A$1:" & Selection.BottomRightCell.Address
'.CenterHorizontally = True
'.CenterVertically = True
.Zoom = False
.FitToPagesWide = 1
.FitToPagesTall = 1
.LeftMargin = Application.InchesToPoints(1)
.RightMargin = Application.InchesToPoints(0)
.TopMargin = Application.InchesToPoints(0.8)
.BottomMargin = Application.InchesToPoints(0)
End With
Unload Me
ActiveSheet.PrintOut
'Supprime la feuille temporaire
Application.DisplayAlerts = False
Sheets(MonNom).Delete
Application.DisplayAlerts = True
End Sub