MsgBox "Pdf files combined successfully!", vbExclamation MsgBox "Error saving combined pdf:" & vbCrLf _ If Not (.Save(PDSaveFull, sPdfComb)) Then MsgBox "Error inserting source pdf:" & vbCrLf _ GetNumPages, PdfSrc, 0, PdfSrc.GetNumPages, 0)) Then MsgBox "Error opening source pdf:" & vbCrLf _ If Dir(sPdf, vbArchive) = vbNullString Then Exit Do & vbCrLf & vbTab & "Procees will be cancelled!", vbCritical MsgBox "Error opening destination pdf:" & vbCrLf _ SPdf = ThisWorkbook.Path & "\" & "firstpdf" & b & ".pdf" SPdfComb = ThisWorkbook.Path & "\" & "Pdf Combined" & Format(Now, " mmdd_hhmm ") & ".pdf" 'change as required Rem Set Combined Pdf filename - save the combined pdf in a new file in order to preserve original pdfs Sub PDFs_Combine_EarlyBound()ĭim PdfDst As AcroPDDoc, PdfSrc As AcroPDDoc To create the Vb Reference to the Adobe Library in the VBA Editor menu click Tools`References then select theAdobe Acrobat Library in the dialog window then press theOK` button. Solutions: These procedures use the Adobe Acrobat Library
All variables should be declared: Dim objCAcroPDDocSource as object, objCAcroPDDocDestination as object.Pdf files names go from firstpdf1.pdf to firstpdfn.pdf where n is the total number of files to be combined.Combined a series of pdf files, located in the same folder of the workbook containing the procedure.This is my understanding of your question: