VBA Excel - Fusionner deux pdf avec PDFCreator
Clemy
-
C-Claire Messages postés 4014 Date d'inscription Statut Membre Dernière intervention -
C-Claire Messages postés 4014 Date d'inscription Statut Membre Dernière intervention -
Bonjour,
J'essaie de faire une macro pour fusionner deux documents pdf mais elle ne marche pas. Quelqu'un pourrait-il m'aider ? Voici la macro
Sub testPrintPDF()
Dim OLDPRINTER As String
Dim FICHIER As String 'Lien vers le dossier où se trouve les pdf
Dim PERIMETRE1 As String 'Nom du 1er pdf
Dim PERIMETRE2 As String 'Nom du 2nd pdf
Dim PDFCREATOR As New clsPDFCreator
OLDPRINTER = ActivePrinter
ActivePrinter = "PDFCreator sur Ne00:"
PERIMETRE1 = "1_TdB PROPRETE - PARIS"
PERIMETRE2 = "2_TdB PROPRETE - DÉCHETTERIE"
FICHIER = ActiveWorkbook.Path
FICHIER = Replace(FICHIER, "3_Calcul", "4_Infocentre")
With PDFCREATOR
.cOption("UseAutosave") = 1
.cOption("UseAutosaveDirectory") = 1
.cOption("AutosaveDirectory") = FICHIER
.cOption("AutosaveFilename") = "combine.pdf"
.cOption("Autosaveformat") = 0
.cStart
.cClearCache
End With
PDFCREATOR.cPrinterStop = True
PDFCREATOR.cPrintFile (FICHIER & PERIMETRE1 & ".pdf") 'pdf-reader pops up and freezes until it is closed
Sleep 200
PDFCREATOR.cPrintFile (FICHIER & PERIMETRE2 & ".pdf") 'pdf-reader pops up and freezes until it is closed
Sleep 200
PDFCREATOR.cCombineAll
PDFCREATOR.cPrinterStop = False
'PDFCREATOR.cClose
ActivePrinter = OLDPRINTER
' Change l'imprimante par défaut
End Sub
Merci de votre aide
J'essaie de faire une macro pour fusionner deux documents pdf mais elle ne marche pas. Quelqu'un pourrait-il m'aider ? Voici la macro
Sub testPrintPDF()
Dim OLDPRINTER As String
Dim FICHIER As String 'Lien vers le dossier où se trouve les pdf
Dim PERIMETRE1 As String 'Nom du 1er pdf
Dim PERIMETRE2 As String 'Nom du 2nd pdf
Dim PDFCREATOR As New clsPDFCreator
OLDPRINTER = ActivePrinter
ActivePrinter = "PDFCreator sur Ne00:"
PERIMETRE1 = "1_TdB PROPRETE - PARIS"
PERIMETRE2 = "2_TdB PROPRETE - DÉCHETTERIE"
FICHIER = ActiveWorkbook.Path
FICHIER = Replace(FICHIER, "3_Calcul", "4_Infocentre")
With PDFCREATOR
.cOption("UseAutosave") = 1
.cOption("UseAutosaveDirectory") = 1
.cOption("AutosaveDirectory") = FICHIER
.cOption("AutosaveFilename") = "combine.pdf"
.cOption("Autosaveformat") = 0
.cStart
.cClearCache
End With
PDFCREATOR.cPrinterStop = True
PDFCREATOR.cPrintFile (FICHIER & PERIMETRE1 & ".pdf") 'pdf-reader pops up and freezes until it is closed
Sleep 200
PDFCREATOR.cPrintFile (FICHIER & PERIMETRE2 & ".pdf") 'pdf-reader pops up and freezes until it is closed
Sleep 200
PDFCREATOR.cCombineAll
PDFCREATOR.cPrinterStop = False
'PDFCREATOR.cClose
ActivePrinter = OLDPRINTER
' Change l'imprimante par défaut
End Sub
Merci de votre aide
A voir également:
- Vba pdfcreator
- Pdfcreator - Télécharger - PDF
- Excel compter cellule couleur sans vba - Guide
- Incompatibilité de type vba ✓ - Forum VB / VBA
- Erreur 13 incompatibilité de type VBA excel ✓ - Forum Excel
- Mkdir vba ✓ - Forum VB / VBA
1 réponse
Bonjour Clemy,
le forum Excel aurait sans doute été plus adapté puisqu'il s'agit d'une macro Excel, le PDF n'étant que le résultat.
Mais regarde le lien suivant qui te donnera peut-être une autre piste :
https://www.excel-downloads.com/threads/fusionner-plusieurs-pdf-par-une-macro.173886/
le forum Excel aurait sans doute été plus adapté puisqu'il s'agit d'une macro Excel, le PDF n'étant que le résultat.
Mais regarde le lien suivant qui te donnera peut-être une autre piste :
https://www.excel-downloads.com/threads/fusionner-plusieurs-pdf-par-une-macro.173886/