VBA PDF Print

Torsten1

New Member
Joined
Feb 25, 2024
Messages
1
Office Version
  1. 2019
Platform
  1. Windows
Hello,

I need help accessing external PDF files and printing them. I currently have the following workflow:I have to fill out a PDF form with form details and save it as a new PDF. Since I don't (can't) use Acrobat, I have to print the PDF using a PDF printer. With this I want to save the new PDF at a specific location.Almost everything works except saving again.

I can view or print the PDF.

- Create and save FDF file
- Rename FDF file to PDF
- Open PDF

But don't print PDF with save without displaying the save dialog. I use PDFX-Change as a PDF printer.With the following code I call up the PDF file for display
ShellExecuteA 0&, "Open", "c:\Test\Antrag.pdf", vbNullString, vbNullString, SW_SHOWMINNOACTIVE

or for printing

ShellExecuteA 0&, "Print", "c:\Test\Antrag.pdf", vbNullString, vbNullString, SW_SHOWMINNOACTIVE

Can someone help me?


VG

Torsten
 

Excel Facts

Excel Wisdom
Using a mouse in Excel is the work equivalent of wearing a lanyard when you first get to college
It's not clear to me which part of your workflow you want to automate with VBA and which part you've already got the code for.

I have to print the PDF using a PDF printer. With this I want to save the new PDF at a specific location.

A PDF printer 'prints' a file to a .pdf file, usually displaying a Save dialogue for the user to choose a location and file name. But if you already have a .pdf file, why do you need to 'print' it to another .pdf file? Can't you just copy it to a specific location and .pdf file name?
 
Upvote 0
Welcome to the MrExcel Message Board!

Cross-posting (posting the same question in more than one forum) is not against our rules, but the method of doing so is covered by #13 of the Forum Rules.

Be sure to follow & read the link at the end of the rule too!

Cross posted at: I need help accessing external PDF files and printing them.
and PDF Print with ShellExecuteA
There is no need to repeat the link(s) provided above but if you have posted the question at other places, please provide links to those as well.

If you do cross-post in the future and also provide links, then there shouldn’t be a problem.
 
Upvote 0

Forum statistics

Threads
1,224,820
Messages
6,181,161
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