![]() You can use something like below to generate the collection of documents to be inserted into your primary doc. I used this resource re method referencesĮDIT: Swapping the array for auto generated (mostly, the primary pdf still set by user) list of pathways to pdfs that you want to insert into the primary pdf) You need to have adobe acrobat installed / operational. OK = primaryDoc.Save(PDSaveFull, arrayFilePaths(0))ĭebug.Print "PRIMARYDOC SAVED PROPERLY: " & OK OK = primaryDoc.InsertPages(numPages, sourceDoc, 0, numberOfPagesToInsert, False)ĭebug.Print "PAGES INSERTED SUCCESSFULLY: " & OK NumberOfPagesToInsert = sourceDoc.GetNumPages OK = sourceDoc.Open(arrayFilePaths(arrayIndex))ĭebug.Print "SOURCE DOC OPENED & PDDOC SET: " & OK Set sourceDoc = CreateObject("AcroExch.PDDoc") Set primaryDoc = CreateObject("AcroExch.PDDoc")ĭebug.Print "PRIMARY DOC OPENED & PDDOC SET: " & OKįor arrayIndex = 1 To UBound(arrayFilePaths) If objCAcroPDDocDestination.InsertPages(objCAcroPDDocDestination.GetNumPages - 1, objCAcroPDDocSource, 0, objCAcroPDDocSource.GetNumPages, 0) Then ObjCAcroPDDocSource.Open ThisWorkbook.Path & "pathwithpdfs" & PDFfileName 'Open the source document that will be added to the destination PDFfileName = Dir(ThisWorkbook.Path & "firstpdf" & n & ".pdf") I get no error msg but perhaps I am missing parts.Īny help would be appreciated. I have tried something like, but cannot seem to get it to work. I would like to not use a plug in tool and have tried with acrobat api below. I am trying to combine PDF's into one single pdf with the use of vba.
0 Comments
Leave a Reply. |