Place all pages into a single PDF file (VBA)

kelly mort

Well-known Member
Joined
Apr 10, 2017
Messages
2,169
Office Version
  1. 2016
Platform
  1. Windows
Hello WORLD,
I am having this issue an I need a way around it:

I am using a for loop to create pdf files of a sheet (page)

Something like ....

For i = 1 To 20
Create_pdf_file
Next i

So the loop produces a page each time with unique data then I also name each pdf file uniquely.

Now I want a way to get say the 20 files created into a single pdf document or file.

If that is possible, can someone please show me the way?

Thanks a lot in Advance.
 

Excel Facts

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().
Are you creating multiple PDF files of the same sheet with different values each time? Please show Create_pdf_file.
 
Upvote 0
Are you creating multiple PDF files of the same sheet with different values each time? Please show Create_pdf_file.
Yes I am creating multiple pdf files of the same sheet.

I am feeding the sheet with vlookup

So each loop counter feeds the sheet with different values.

I am not with my pc at the moment so I can't get you the exact code.

I wish the above have made it clearer.
 
Upvote 0
Since it is multiple versions of the same sheet, they would have to be merged/appended to an existing PDF file. Excel does not have this capability.

It is possible to do this if you have Adobe Acrobat Professional installed (not Acrobat Reader). Acrobat provides an API that can be called from VBA. Other products may offer that also but I am not familiar with them.

Another option is that each time you update the sheet, copy values to a new sheet. Then when you are finished you can select all the new sheets and export them to a single PDF file. Then you can delete them. I can't help with that unless I have your existing code.
 
Upvote 0

Forum statistics

Threads
1,214,988
Messages
6,122,620
Members
449,092
Latest member
amyap

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