Imprimer des selections excel en pdf par VBA
Si qqn a deja fait cela, j'aimerais avoir de l'aide. Mon probleme est que j'ai 4 feuilles excel et je selectionne des cellules dans chacune d'elle.
Situation:
J'ai deja une application qui imprime 4 feuilles de papier don chacune correspond a 1 feuille Excel. Moi je voudrait faire en sorte que c'est 4 feuilles donne 1 fichier pdf seulement. Je me demande s'il es possible de faire un range incluant des cellules de plusieurs feuilles et également les séparer par page ds mon pdf.
Je crois bien que ce projet est tre compliqué et ne sera pas faisable.
Mais si qqn se sent d'attaque pour m'aider et bien MERCI.
Code:
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
|
Sheets("Production").Select
If (imp_prod) Then
Range("Production!B1:N" & Ind_Prod).Select
ActiveSheet.PageSetup.PrintArea = "$B$1:$T" & Ind_Prod
With ActiveSheet.PageSetup
.LeftMargin = 0.8
.RightMargin = 0.7
.TopMargin = 2.5
.BottomMargin = 2.5
'.HeaderMargin =
.PrintHeadings = False
.PrintGridlines = False
.PrintComments = xlPrintNoComments
.PrintQuality = 600
.CenterHorizontally = True
.Orientation = xlLandscape
.PaperSize = xlPaperLetter
.Zoom = 80
.PrintErrors = xlPrintErrorsDisplayed
End With
If (imp_pdf) Then
oldPrinter = Application.ActivePrinter
Application.ActivePrinter = "Adobe PDF sur Ne01:"
myPath = "C:\"
myFilename = NomFichierSom & "Prod"
ActiveWindow.SelectedSheets.PrintOut ActivePrinter:="Adobe PDF sur Ne01:"
Application.ActivePrinter = oldPrinter
End If
'ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
End If
Sheets("SommaireMat").Select
If (imp_prod) Then
Range("SommaireMat!B1:E" & Ind_Prod2).Select
ActiveSheet.PageSetup.PrintArea = "$B$1:$E" & Ind_Prod2
With ActiveSheet.PageSetup
.LeftMargin = 0.8
.RightMargin = 0.7
.TopMargin = 2.5
.BottomMargin = 2.5
'.HeaderMargin =
.PrintHeadings = False
.PrintGridlines = False
.PrintComments = xlPrintNoComments
.PrintQuality = 600
.CenterHorizontally = True
.Orientation = xlPortrait
.PaperSize = xlPaperLetter
.Zoom = 100
.PrintErrors = xlPrintErrorsDisplayed
End With
If (imp_pdf) Then
oldPrinter = Application.ActivePrinter
Application.ActivePrinter = "Adobe PDF sur Ne01:"
myPath = "C:\"
myFilename = NomFichierSom & "SommMAt"
'ActiveWindow.SelectedSheets.PrintOut PrtoFileName:=myPath & myFilename & ".ps", PrintToFile:=True
Application.ActivePrinter = oldPrinter
End If |