Avatar of Kevin
KevinFlag for United States of America

asked on 

Excel VBA: Set PDF as printer, set filename, and set to append

We have an excel spreadsheet that runs some automated sorting and printing.  Currently it loops through and selects various ranges on a sheet, and send them to a printer.  The "printouts" of these ranges are never saved per-se, only printed.  So we cannot easily  recreate then later....

What we would like to do is have the Excel VBA:

1. select the PDF driver as the default printer (we have a few different PDF creators...)
2. set the path and filename of the SINGLE file to be created
3. Loop through the process mentioned above and write to the desired PDF - with each print command APPENDING to the existing PDF file.
4. Reset the default printer to what it was before.

or any other way to basically do the same thing.

Thanks everyone, and wishing you all well during these stay-at-home times.

Kevin
Printers and ScannersPDF

Avatar of undefined
Last Comment
Kevin
Avatar of Louis LIETAER
Louis LIETAER
Flag of France image

dim myprinter as string
dim printer_name as sttring
printer_name ="name goes here"

    myprinter = Application.ActivePrinter
    Change_Form.PrintOut Preview:=False, ActivePrinter:=printer_name, PrintToFile:=True, PrToFileName:=PSFileName
    Application.ActivePrinter = myprinter
Avatar of Kevin
Kevin
Flag of United States of America image

ASKER

Thanks Louis.  Most PDF printers that I know of do not allow configuration to automatically append to a file without user interaction.  Can windows inherently do that somehow?
Hi, you may check the preferences of your pdf printer, but sure it will depend of the driver.

You may find one here : https://pdf.wondershare.com/top-pdf-software/free-pdf-printer.html
ASKER CERTIFIED SOLUTION
Avatar of Arana (G.P.)
Arana (G.P.)

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Avatar of Kevin
Kevin
Flag of United States of America image

ASKER

Thanks Louis and Arana.  I will investigate!!!
Printers and Scanners
Printers and Scanners

A printer is a peripheral which makes a persistent human readable representation of graphics or text on paper or similar physical media. Traditional printers are being used more for special purposes, like printing photographs or artwork, and are no longer a must-have peripheral; 3D printing has become an area of intense interest, allowing the creation of physical objects. An image scanner is a device that optically scans images, printed text, handwriting, or an object, and converts it to a digital image. Hand-held scanners, where the device is moved by hand, have evolved from text scanning "wands" to 3D scanners used for industrial design, reverse engineering, test and measurement, orthotics, gaming and other applications.

22K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo