Combine Multiple PDFs Using VBA

avpenaloza

New Member
Joined
Dec 16, 2021
Messages
6
Office Version
  1. 2016
Platform
  1. Windows
Creating a new thread for additional help - previous thread:
Combine multiple PDF files with VBA

I am trying to merge PDFs. I have a set of PDFs in Folder A, a set of PDFs in Folder B, and I want them merged into Folder C.
In Folder A, there is 1 PDF that will be matched with a variable number of PDFs in Folder B.

I set the excel spreadsheet up like this and tried the code given to me in the previous thread and something worked.
But I am thinking maybe I set my spreadsheet up wrong because the outputs (Test2 and Test3) were overridden by the previous rows. Only the last row of each duplicate NewFile was merged.

Is there a better way I can set up my spreadsheet so that if 1 PDF from Folder A is going to be merged with say 20 PDFs from Folder B they don't just override each other?

Thank you so much for your help in advance @John_w !


File Path 1File Path 2NewFile
C:\Users\apenaloza\Documents\Attachments\Test.pdfC:\Users\apenaloza\Desktop\Working\Macro Test\Invoice 1.pdfC:\Users\apenaloza\Desktop\Working\Macro Test OUTPUT\Test1.pdf
C:\Users\apenaloza\Documents\Attachments\Test1.pdfC:\Users\apenaloza\Desktop\Working\Macro Test\Invoice 2.pdfC:\Users\apenaloza\Desktop\Working\Macro Test OUTPUT\Test2.pdf
C:\Users\apenaloza\Documents\Attachments\Test1.pdfC:\Users\apenaloza\Desktop\Working\Macro Test\Invoice 3.pdfC:\Users\apenaloza\Desktop\Working\Macro Test OUTPUT\Test2.pdf
C:\Users\apenaloza\Documents\Attachments\Test2.pdfC:\Users\apenaloza\Desktop\Working\Macro Test\Invoice 4.pdfC:\Users\apenaloza\Desktop\Working\Macro Test OUTPUT\Test3.pdf
C:\Users\apenaloza\Documents\Attachments\Test2.pdfC:\Users\apenaloza\Desktop\Working\Macro Test\Invoice 5.pdfC:\Users\apenaloza\Desktop\Working\Macro Test OUTPUT\Test3.pdf
C:\Users\apenaloza\Documents\Attachments\Test2.pdfC:\Users\apenaloza\Desktop\Working\Macro Test\Invoice 6.pdfC:\Users\apenaloza\Desktop\Working\Macro Test OUTPUT\Test3.pdf
C:\Users\apenaloza\Documents\Attachments\Test2.pdfC:\Users\apenaloza\Desktop\Working\Macro Test\Invoice 7.pdfC:\Users\apenaloza\Desktop\Working\Macro Test OUTPUT\Test3.pdf
 

Excel Facts

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"
But I am thinking maybe I set my spreadsheet up wrong because the outputs (Test2 and Test3) were overridden by the previous rows. Only the last row of each duplicate NewFile was merged.

Is there a better way I can set up my spreadsheet so that if 1 PDF from Folder A is going to be merged with say 20 PDFs from Folder B they don't just override each other?
You can't have 2 files with the same name in a folder. Therefore make the column C file names unique.
 
Upvote 0

Forum statistics

Threads
1,223,880
Messages
6,175,154
Members
452,615
Latest member
bogeys2birdies

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top