OVH Cloud OVH Cloud

Impression

1 réponse
Avatar
nutrino
Bonjour au forum,

J'ai un formulaire dans lequel sont affichés différents résultats.
J'aimerais imprimer ces résultats depuis ce formulaire à laide d'un bouton.
POuvez vous m'aider??

merci

1 réponse

Avatar
Michel Pierron
Bonjour Nutrino:
Impression en mode paysage par classeur masqué:
Private Declare Function OpenClipboard& Lib "user32" (ByVal hwnd&)
Private Declare Function EmptyClipboard& Lib "user32" ()
Private Declare Function CloseClipboard& Lib "user32" ()
Private Declare Sub keybd_event Lib "user32" (ByVal bVk As Byte _
, ByVal bScan As Byte, ByVal dwFlags&, ByVal dwExtraInfo&)

Private Sub CommandButton1_Click() ' Impression écran
Me.Repaint
OpenClipboard 0&
EmptyClipboard
keybd_event &H2C, 0, 0&, 0&
CloseClipboard
DoEvents
Application.ScreenUpdating = False
Dim NewBook As String
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
Me.Hide
On Error Resume Next
Windows(NewBook).SelectedSheets.PrintOut Copies:=1
Workbooks(NewBook).Close False
Me.Show
End Sub

MP

"nutrino" a écrit dans le message de
news:
Bonjour au forum,

J'ai un formulaire dans lequel sont affichés différents résultats.
J'aimerais imprimer ces résultats depuis ce formulaire à laide d'un
bouton.

POuvez vous m'aider??

merci