Dans le haut du module de ton formulaire, déclaration des API
Private Declare Function OpenClipboard Lib "user32" (ByVal hwnd As Long) As Long
Private Declare Function EmptyClipboard Lib "user32" () As Long
Private Declare Function CloseClipboard Lib "user32" () As Long
Private Declare Sub keybd_event Lib "user32" (ByVal bVk As Byte _
, ByVal bScan As Byte, ByVal dwFlags As Long, ByVal dwExtraInfo As Long)
'La macro est liée à un bouton de commande dans ton formulaire
Private Sub CommandButton1_Click()
Dim NewBook As String
Me.Repaint
OpenClipboard 0&
EmptyClipboard
keybd_event vbKeySnapshot, 0, 0&, 0&
CloseClipboard
DoEvents
Application.ScreenUpdating = False
Workbooks.Add: ActiveSheet.Paste
NewBook = ActiveWorkbook.Name
With ActiveSheet.PageSetup
.RightFooter = Me.Caption & " Le &D Page &P/&N"
.PrintGridlines = False
.Orientation = xlLandscape
.PaperSize = xlPaperA4
.Zoom = False
.FitToPagesWide = 1
.FitToPagesTall = False
End With
ActiveWindow.Visible = False
Application.ScreenUpdating = True
Windows(NewBook).SelectedSheets.PrintOut Copies:=1
Workbooks(NewBook).Close False
End Sub