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
Re: Printing an external file from vba (ie PDF)
Search the forum on ShellExecute ;)
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.
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
Re: Printing an external file from vba (ie PDF)