1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
|
Sub Imprimer_tableau()
Dim intColMin As Integer
Dim intColMax As Integer
Dim intLinMin As Integer
Dim intLinMax As Integer
Dim reponse As Byte
'Situer la zone à imprimer
intColMin = 1 'Première colonne à imprimer
intColMax = 6 'Dernière colonne à imprimer
intLinMin = 13 'Première ligne à imprimer
intLinMax = 22 'Dernière ligne à imprimer
'Renseignement des lignes et colonnes à imprimer
ActiveSheet.PageSetup.PrintArea = Range(Cells(intLinMin, intColMin), _
Cells(intLinMax, intColMax)).Address
'Réglage des propriétés d'impression
ActiveSheet.PageSetup.Orientation = xlLandscape
ActiveSheet.PageSetup.CenterHorizontally = True
ActiveSheet.PageSetup.CenterVertically = True
'Etes-vous sur de vouloir imprimer ???
reponse = MsgBox("Voulez-vous vraiment imprimer ce tableau ?", _
vbquestios + vbYesNo + vbDefaultButton1)
If reponse = vbNo Then Exit Sub
End If
'Affiche l'onglet pour déterminer ou imprimer
Application.Dialogs(xlDialogPrinterSetup).Show 'Appel l'imprimante à sélectionner
ActiveWindow.SelectedSheets.PrintOut 'Imprime le fichier
End Sub |
Partager