Bonjour
J'ai un fichier excel comportant 3 feuilles et j'aimerais en VBA créer un fichier PDF avec 3 pages : une feuille par page. Pour l'instant j'arrive à créer un fichier PDF d'une page avec ma première feuille. mais je ne sais pas comment aller plus loin. Merci de votre aide.
Voici mon code pour crée mon fichier d'une page :
ça ça marche très bien et j'ai essayé de faire pareil mais simplement en sélectionnant les 3 feuilles (sheets.select) au début mais ça ne fonctionne pas.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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 Sheets("feuil1").PageSetup.PrintArea = Range("A1", ActiveCell.SpecialCells(xlLastCell)).Address Sheets("Suivi des délais Forfait").PageSetup.CenterHorizontally = True Sheets("Suivi des délais Forfait").PageSetup.CenterVertically = False Dim PDFCreator1 As PDFCreator.clsPDFCreator Set PDFCreator1 = New PDFCreator.clsPDFCreator If PDFCreator1.cStart("/NoProcessingAtStartup") = False Then 'creation d'un fichier de log End If Dim nomfichier, corpsmessage As String nomfichier = "delaisS" & Format(Date - 4, "ww") & ".pdf" With PDFCreator1 .cOption("UseAutosave") = 1 .cOption("UseAutosaveDirectory") = 1 .cOption("AutoSaveDirectory") = "c:\GEC\delais" .cOption("AutoSaveFilename") = nomfichier .cOption("AutosaveFormat") = 0 ' 0 = PDF .cClearCache .cDefaultPrinter = "PDFCreator" End With ActiveSheet.PrintOut Copies:=1, ActivePrinter:="PDFCreator" Do Until PDFCreator1.cCountOfPrintjobs = 1 DoEvents Sleep 1000 Loop PDFCreator1.cPrinterStop = False Do Until PDFCreator1.cCountOfPrintjobs < 1 DoEvents Sleep 1000 Loop
Une idée ?
Partager