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
| Option Explicit
Sub Fusion_PDFs()
Dim oPDDoc1 As Object
Dim oPDDoc2 As Object
Dim oPDDoc3 As Object
Dim Num As Long
Set oPDDoc1 = CreateObject("AcroExch.PDDoc")
Set oPDDoc2 = CreateObject("AcroExch.PDDoc")
Set oPDDoc3 = CreateObject("AcroExch.PDDoc")
oPDDoc1.Open (ThisWorkbook.Path & "\" & "1.pdf")
oPDDoc2.Open (ThisWorkbook.Path & "\" & "2.pdf")
oPDDoc3.Open (ThisWorkbook.Path & "\" & "3.pdf")
' Pour connaitre le nombre de pages
' Num = oPDDoc1.GetNumPages()
' Paramètres :
' 1 Page du document en cours après laquelle l'insertion sera faite. La 1ere page est 0.
' 2 Document contenant les pages à insérer.
' 3 La 1ere page à être insérée dans le document en cours à partir du Document contenant les pages à insérer.
' 4 Le nombre de pages à insérer.
' 5 Si nombre > 0 les bookmarks sont copiés, si 0 ils ne le sont pas.
oPDDoc1.InsertPages 0, oPDDoc2, 0, 1, 0
oPDDoc1.InsertPages 1, oPDDoc3, 0, 1, 0
oPDDoc1.Save 1, ThisWorkbook.Path & "\" & "Fusion.pdf"
oPDDoc3.Close
oPDDoc2.Close
oPDDoc1.Close
Set oPDDoc3 = Nothing
Set oPDDoc2 = Nothing
Set oPDDoc1 = Nothing
End Sub |
Partager