

'Open the source document that will be added to the destinationįor i = LBound(arrFiles) + 1 To UBound(arrFiles) 'Open each subsequent PDF that you want to add to the original ObjCAcroPDDocDestination.Open (arrFiles(LBound(arrFiles))) 'open the first file 'Open Destination, all other documents will be added to this and saved with Set objCAcroPDDocSource = CreateObject("AcroExch.PDDoc") Set objCAcroPDDocDestination = CreateObject("AcroExch.PDDoc") Public Function MergePDFs(arrFiles() As String, strSaveAs As String) As Booleanĭim objCAcroPDDocDestination As Acrobat.CAcroPDDocĭim objCAcroPDDocSource As Acrobat.CAcroPDDoc If bSuccess = False Then MsgBox "Failed to combine all PDFs", vbCritical, "Failed to Merge PDFs"ĭoCmd.RunSQL "delete from scantemp" 'delete all paths from table scantemp after converted it to pdf StrNPDF = CurrentProject.Path & "\request_pic\" & (request_no) & ".pdf" Set RS = DB.OpenRecordset("SELECT from scantemp ") Notice:-the number of pdfs files to be merged varies from time to time. I have a table that contains a paths of multi pdfs file.now I need a VBA code to merge all these files to a single pdf file.
