Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Merge multiple access reports to one pdf file using vba

Tags:

pdf

vba

ms-access

I wan't to merge multiple access reports to one pdf file using vba code. This vba code needs to work on the computers at my work. These computers only contain Adobe Reader, and I am not able to install Acrobat because I am not Administrator. So now my code generates for all the reports a seperate pdf. I had some code to merge these pdf files to one pdf file where I use 'Acrobat.CAcroApp'. But i get an error on line:

Set AcroApp = CreateObject("AcroExch.App")

I think I am not able to do this cause the computers only have Adobe Reader installed. Is there a possibility to create one pdf file for multiple reports/pdfs without using Acrobat.

Thx in advance

like image 392
Vinny Avatar asked Oct 30 '25 08:10

Vinny


2 Answers

2 solutions.

  1. Make a master report that has each individual report embedded as a sub report. If it's just a few, it should work fine, but too many may bog down / crash the application.
  2. Here's a VBA way of doing it here.
like image 185
Tom Collins Avatar answered Nov 01 '25 12:11

Tom Collins


Without acrobat reader this is indeed not going to work. I, however, am using the following dirty workaround for users without acrobat;

Export all your reports to rich text ("*.RTF" format) in the same folder. Afterwards, you open a word application via access vba, and loop through the RTF files and then copy them into your word file, with a page break after every insert. Then, you save the word document as a .PDF file.

This is a method prone to errors, so if a more experienced user has a better way, please do tell. I'm interested as well!

like image 38
Jens Avatar answered Nov 01 '25 13:11

Jens



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!