impression USF centré et paysage

Ilino

XLDnaute Barbatruc
Bonjour Forum
je souhaite imprimer mon USF ci dessous le code qui fonctionne parfaitement
Code:
Private Sub CommandButton2_imprimer_Click()
UserForm8_rechercher.PrintForm
End Sub
mon souci est comment faire pour l'imprimer au centre de la feuille et paysage
GRAZIE
 

Ilino

XLDnaute Barbatruc
Re : impression USF centré et paysage

Re
merci pour le lien , et après Test
Code:
Private Sub CommandButton2_imprimer_Click()

   Printer.Orientation = 2
   Screen.ActiveForm.PrintForm

End Sub
j'ai ce buge
"variable non définie"
a+
 

Ilino

XLDnaute Barbatruc
Re : impression USF centré et paysage

Re néanmoins j'ai trouvé un code très long
Code:
Private Sub CommandButton2_imprimer_Click()

       Dim Ws As Worksheet
    
    'pplication.ScreenUpdating = False
    
    '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
    Ws.PageSetup.Orientation = xlLandscape
    Ws.Paste

    
    Unload Me
    
    'Impression centrée dans la page
    With Ws
        .PageSetup.CenterHorizontally = True
        .PageSetup.CenterVertically = True
        .PageSetup.LeftMargin = 0
        .PrintOut
    End With
    
    Application.DisplayAlerts = False
    
    ActiveSheet.Delete
    
    Application.DisplayAlerts = True
   
    Application.ScreenUpdating = True
  
UserForm8_rechercher.PrintForm
End Sub
qui fonctionne.
A+
 

Discussions similaires

Statistiques des forums

Discussions
312 492
Messages
2 088 936
Membres
103 987
dernier inscrit
Doctami