Extract PDF according to specific criteria

Green171224

New Member
Joined
Dec 16, 2024
Messages
3
Office Version
  1. 365
Platform
  1. Windows
Hello,

I need some very general help with vba.
I have a pdf file with approximately 150 payslips. I also have a list with employers - numbers, names and their managers. Each manager should receive only payslips for her/his team according to the data in excel. Is it possible to create a VBA that would extract pages from initial PDF according to the criteria in Excel (employee nr or name and surname), combine them and save a separate pdf for each manager in a specific folder?

Best,
Inna
 

Excel Facts

Excel Joke
Why can't spreadsheets drive cars? They crash too often!
I would recommend using Power Query to extract PDF information, and then use VBA to send them if their name is in the PDF. Start with this link and then we can do the VBA part after.
 
Upvote 0
This is possible, but quite tricky.

If you have Acrobat Pro installed then you could do the following by calling the Acrobat API from Excel VBA: extract the individual pages from the main PDF file; read each 'page' PDF to identify the employee name in it; combine that 'page' PDF with that employee's 'manager' PDF according to your list in Excel.

Otherwise you'd need a third party tool such as PDFtk Server and do the following steps from Excel VBA: run its 'burst' command to split the main PDF into separate PDFs for each page; import each 'page' PDF into Excel using Word VBA to identify the employee name in it; run its 'cat' command to combine that 'page' PDF with that employee's 'manager' PDF according to your list in Excel.

There should be example code on this forum for all the steps in both approaches.
 
Upvote 0
This is possible, but quite tricky.

If you have Acrobat Pro installed then you could do the following by calling the Acrobat API from Excel VBA: extract the individual pages from the main PDF file; read each 'page' PDF to identify the employee name in it; combine that 'page' PDF with that employee's 'manager' PDF according to your list in Excel.

Otherwise you'd need a third party tool such as PDFtk Server and do the following steps from Excel VBA: run its 'burst' command to split the main PDF into separate PDFs for each page; import each 'page' PDF into Excel using Word VBA to identify the employee name in it; run its 'cat' command to combine that 'page' PDF with that employee's 'manager' PDF according to your list in Excel.

There should be example code on this forum for all the steps in both approaches.
Thank you! I'll see what suits best for our process.
 
Upvote 0

Forum statistics

Threads
1,224,817
Messages
6,181,148
Members
453,021
Latest member
Justyna P

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