Merge 3 PDF files together into 1 PDF file using VBA

NOTE: this requires you to have Adobe Acrobat Standard or Professional (i.e. a paid version). It won't work if all you have is Adobe Reader on your PC.

Dim gPDDoc1 As AcroPDDoc

Dim gPDDoc2 As AcroPDDoc

Dim gPDDOC3 as AcroPDDoc

Set gPDDoc1 = CreateObject("AcroExch.PDDoc")

Set gPDDoc2 = CreateObject("AcroExch.PDDoc")

Set gPDDoc3 = CreateObject("AcroExch.PDDoc")

chk1 = gPDDoc1.Open("C:\test\test.pdf")

chk2 = gPDDoc2.Open("C:\test\test2.pdf")

chk3 = gPDDoc3.Open("C:\test\test3.pdf")

mergefile = gPDDoc1.InsertPages(0, gPDDoc2, 0, 1, 0)

mergefile = gPDDoc1.InsertPages(1, gPDDoc3, 0, 1, 0)

savemergefile = gPDDoc1.Save(1, "C:\test\merged.pdf")