|
-
Oct 1st, 2009, 02:30 PM
#1
Thread Starter
New Member
Printing an external file from vba (ie PDF)
I have a spreadsheet in Excel 07 with a complete path/filename in each cell (ie C:\test.pdf). I want that, pressing a button, all these files are sent to the printer.
Is this possible? and if it is possible, can I modify some settings like page number, number of copies, page size, fit to page, ...?
I know how to do all, except the printing part.
thanks
-
Oct 1st, 2009, 02:43 PM
#2
Re: Printing an external file from vba (ie PDF)
Search the forum on ShellExecute
A good exercise for the Heart is to bend down and help another up...
Please Mark your Thread " Resolved", if the query is solved
MyGear:
★ CPU ★ Ryzen 5 5800X
★ GPU ★ NVIDIA GeForce RTX 3080 TI Founder Edition
★ RAM ★ G. Skill Trident Z RGB 32GB 3600MHz
★ MB ★ ASUS TUF GAMING X570 (WI-FI) ATX Gaming
★ Storage ★ SSD SB-ROCKET-1TB + SEAGATE 2TB Barracuda IHD
★ Cooling ★ NOCTUA NH-D15 CHROMAX BLACK 140mm + 10 of Noctua NF-F12 PWM
★ PSU ★ ANTEC HCG-1000-EXTREME 1000 Watt 80 Plus Gold Fully Modular PSU
★ Case ★ LIAN LI PC-O11 DYNAMIC XL ROG (BLACK) (G99.O11DXL-X)
★ Monitor ★ LG Ultragear 27" 240Hz Gaming Monitor
★ Keyboard ★ TVS Electronics Gold Keyboard
★ Mouse ★ Logitech G502 Hero
-
Oct 1st, 2009, 04:28 PM
#3
Thread Starter
New Member
Re: Printing an external file from vba (ie PDF)
Seems that shellexecute works as the run command in windows. Can run adobe reader to open a file but no more.
In the spreadsheet I have a list like:
FILENAME COPIES SIZE LAYOUT PRINTER
--------------------------------------------------
a.pdf 1 A4 Fit to page printer1
b.pdf 3 A5 Fit to page printer2
c.pdf 2 A3 Fit to page printer1
My point is that, clicking one time a button, the code must read the list and send each file to the specified printer with the specified settings.
And it must work without having acrobat pro installed. At most adobe reader.
The executable of adobe reader has some parameters. One of them allows printing directly a file, but unfortunately without settings.
Basically, this thing could be a kind of customized spool inside MS Office.
-
Oct 2nd, 2009, 04:07 AM
#4
Re: Printing an external file from vba (ie PDF)
you can chose the printer to print to, by changing the windows default printer before calling shell execute, remember to change back after printing
also it is possible if the page size for the printer is set before printing the pdf reader will pick that paper size automatically
you would need to use printer APIs to do that
i don't believe you can automate acrobat reader at all
i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next
dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part
come back and mark your original post as resolved if your problem is fixed
pete
-
Oct 2nd, 2009, 04:18 AM
#5
Re: Printing an external file from vba (ie PDF)
A good exercise for the Heart is to bend down and help another up...
Please Mark your Thread " Resolved", if the query is solved
MyGear:
★ CPU ★ Ryzen 5 5800X
★ GPU ★ NVIDIA GeForce RTX 3080 TI Founder Edition
★ RAM ★ G. Skill Trident Z RGB 32GB 3600MHz
★ MB ★ ASUS TUF GAMING X570 (WI-FI) ATX Gaming
★ Storage ★ SSD SB-ROCKET-1TB + SEAGATE 2TB Barracuda IHD
★ Cooling ★ NOCTUA NH-D15 CHROMAX BLACK 140mm + 10 of Noctua NF-F12 PWM
★ PSU ★ ANTEC HCG-1000-EXTREME 1000 Watt 80 Plus Gold Fully Modular PSU
★ Case ★ LIAN LI PC-O11 DYNAMIC XL ROG (BLACK) (G99.O11DXL-X)
★ Monitor ★ LG Ultragear 27" 240Hz Gaming Monitor
★ Keyboard ★ TVS Electronics Gold Keyboard
★ Mouse ★ Logitech G502 Hero
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|