The first file in the collection would be the file that you are inserting into, same as in first example. 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. Here are three of them I tested that seem to be pretty good.I am trying to combine PDF's into one single pdf with the use of vba.
If you don’t have a full version of Adobe Acrobat around, spending $40-$50 on one of these tools is not a bad choice. There are a lot of commercial tools available on the market specifically designed for this type of task. If the number of files is small and the privacy of the documents isn’t your main concern, this online tool could be a very effective choice to get the job done. Zamzar is an online document conversion tool that has a feature that can convert MSG into PDF files. The final copy is an Adobe PDF Portfolio file that requires Adobe Flash to open. To include attachments in the result, go to Settings tab and make sure ” Include all attachments” option is selected. Go to Adobe PDF tab in Outlook and click Setup Automatic Archival.Īdd the Outlook folder that contains the message files you want to convert and press Run Archival Now button to start. The attachments will be saved as separate PDF files. If the attachments are required, go to Print Options and check the option “ Print attached files” before hitting the Print button. Select Adobe PDF as the printer and hit Print button to start the converting process. You can highlight the emails you want to convert and press Ctrl+P to bring up the print dialog box. Note that, directly dragging and dropping MSG files to the Combine Files window will not work. If everything goes well, you will have a single PDF file for all the messages including the attachments. Once done, click Combine Files button to start converting them.
Then open Outlook and drag all the emails you want to convert into the Combined Files window. Open Adobe Acrobat and choose Combine Files into PDF from the Select a Task section. Using Adobe’s Combine Files into PDF feature The easiest way of doing it is to create a temporary folder in Outlook and drag all the MSG files into that folder. But before you dive into it, you need to import all your MSG files into Outlook first. If you have Outlook 2010 or above installed along with a full standard version of Adobe Acrobat, you have three ways to get this job done. Work with Outlook and Adobe Acrobat Standard If you have a need to batch convert a large group of Outlook email files into PDF format, here are the ways you can try.