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 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170
| Sub Aperçu_Impression()
Dim NB_Lignes As Integer
Dim Nb_colonnes As Long
Dim Coef As Single
Feuil1.Select
With Feuil1
Select Case xlOn
Case .OptionButtons(1).Value
Coef = 1
Case .OptionButtons(2).Value
Coef = 1.25
Case .OptionButtons(3).Value
Coef = 1.67
Case .OptionButtons(4).Value
Coef = 2.5
Case .OptionButtons(5).Value
Coef = 5
Case .OptionButtons(6).Value
Coef = 10
End Select
End With
'Creation d'une zone nommee destinee a etre imprimee
Range("Debut_tableau").Offset(2, 9).Select
NB_Lignes = Range(ActiveCell, ActiveCell.End(xlDown)).Rows.Count
Nb_colonnes = Range("Cycle").Value * Coef
If Nb_colonnes < 482 Then Nb_colonnes = 482
Range("debut_graph").Offset(NB_Lignes + 1, Nb_colonnes).Select
Range(ActiveCell, Range("debut")).Select
Selection.Name = "Impression"
'mise en page de la zone d'impression
'A3 Paysage, marges laterales 1cm haut-bas 2 cm, ajusté a 1 page en largeur, centre horizontalement
Application.PrintCommunication = False
With ActiveSheet.PageSetup
.PrintTitleRows = ""
.PrintTitleColumns = ""
End With
Application.PrintCommunication = True
ActiveSheet.PageSetup.PrintArea = "impression"
Application.PrintCommunication = False
With ActiveSheet.PageSetup
.LeftMargin = Application.InchesToPoints(0.393700787401575)
.RightMargin = Application.InchesToPoints(0.393700787401575)
.TopMargin = Application.InchesToPoints(0.78740157480315)
.BottomMargin = Application.InchesToPoints(0.78740157480315)
.HeaderMargin = Application.InchesToPoints(0.31496062992126)
.FooterMargin = Application.InchesToPoints(0.31496062992126)
.CenterHorizontally = True
.Orientation = xlLandscape
.PaperSize = xlPaperA3
.FitToPagesWide = 1
End With
Application.PrintCommunication = True
'ouvre l'apercu avant impression
ActiveSheet.PrintPreview
End Sub
Sub Impression()
Dim NB_Lignes As Integer
Dim Nb_colonnes As Double
Dim Chemin As String
Dim Nom_Fichier As String
Dim Coef As Single
Feuil1.Select
With Feuil1
Select Case xlOn
Case .OptionButtons(1).Value
Coef = 1
Case .OptionButtons(2).Value
Coef = 1.25
Case .OptionButtons(3).Value
Coef = 1.67
Case .OptionButtons(4).Value
Coef = 2.5
Case .OptionButtons(5).Value
Coef = 5
Case .OptionButtons(6).Value
Coef = 10
End Select
End With
'Creation d'une zone nommee destinee a etre imprimee
Range("Debut_tableau").Offset(2, 9).Select
NB_Lignes = Range(ActiveCell, ActiveCell.End(xlDown)).Rows.Count
Nb_colonnes = Range("Cycle").Value * Coef
If Nb_colonnes < 482 Then Nb_colonnes = 482
Range("debut_graph").Offset(NB_Lignes + 1, Nb_colonnes).Select
Range(ActiveCell, Range("debut")).Select
Selection.Name = "Impression"
'mise en page de la zone d'impression
'A3 Paysage, marges laterales 1cm haut-bas 2 cm, ajusté a 1 page en largeur, centre horizontalement
Application.PrintCommunication = False
With ActiveSheet.PageSetup
.PrintTitleRows = ""
.PrintTitleColumns = ""
End With
Application.PrintCommunication = True
ActiveSheet.PageSetup.PrintArea = "impression"
Application.PrintCommunication = False
With ActiveSheet.PageSetup
.LeftMargin = Application.InchesToPoints(0.393700787401575)
.RightMargin = Application.InchesToPoints(0.393700787401575)
.TopMargin = Application.InchesToPoints(0.78740157480315)
.BottomMargin = Application.InchesToPoints(0.78740157480315)
.HeaderMargin = Application.InchesToPoints(0.31496062992126)
.FooterMargin = Application.InchesToPoints(0.31496062992126)
.CenterHorizontally = True
.Orientation = xlLandscape
.PaperSize = xlPaperA3
.FitToPagesWide = 1
End With
Application.PrintCommunication = True
'Exporte au format PDF
Nom_Fichier = ActiveSheet.Shapes("r_work").TextFrame.Characters.Text _
& "_" & ActiveSheet.Shapes("r_Product").TextFrame.Characters.Text _
& "_" & ActiveSheet.Shapes("r_routing").TextFrame.Characters.Text _
& "_" & ActiveSheet.Shapes("r_index").TextFrame.Characters.Text
With Application.FileDialog(msoFileDialogFolderPicker)
If .Show = -1 Then
Chemin = .SelectedItems(1)
Else
Exit Sub
End If
End With
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:=Chemin & "\" & Nom_Fichier & ".pdf", _
Quality:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas _
:=False, OpenAfterPublish:=False
'repositionne au debut du tableau
Range("Debut_tableau").Offset(0, 5).Select
'efface la zone d'impression
ActiveSheet.PageSetup.PrintArea = ""
End Sub |
Partager