Apr 12 2012, 11:33 AM
I am trying to print some pdf files using windows api function:
lngReturn = apiShellExecute(0, "print", currentFile, vbNullString, vbNullString, 0)
But it prints on the wrong printer tray. I would like to print on a specific tray.
Is this possible at all? And does anyone know if this should be controlled from the printer properties ?
Thanks for you support
Apr 12 2012, 02:38 PM
You might want to check out this Microsoft Knowledgebase article
on "How to Print a Report to Different Paper Trays".
If that doesn't do the trick, search our Reports forum using keywords like "specific" and "tray", and you'll see many previous discussions on the topic.
Hope this helps,
Apr 13 2012, 10:27 AM
Thanks for your reply Dennis,
Your link unfortunately only applies to Access reports as do all the topics in Reports section here. I have in fact searched prior to my question here. I've googled, but found no answer yet to this.
What I am looking is to print on specific tray when using "windows shell print". I need to print this way as the file is stored as pdf. I am using the above code and "apiShellExecute" function declaration in my module to print the pdf file, but need control over the printer trays.
I think the only way this can be achieved is via the printer properties, but so far have failed.
Apr 13 2012, 10:51 AM
You might have better luck asking this question on a forum that's focused on Adobe products, since it looks like you're trying to control Acrobat (or Acrobat Reader) from basically a command-line environment.
Now that I've typed that parenthetical statement, perhaps you could also look into 3rd-party PDF software as well.
The only thing else I can contribute is that I have a vague recollection of reading a thread here about people setting up multiple virtual "printers" on their computer, using different properties of the same physical printer. So, one "printer" on the computer was "print to the Canon XYZ printer, using the main tray", and another "printer" was "print to the Canon XYZ printer, using the auxiliary tray".
Hope this helps,
Apr 13 2012, 11:28 AM
Dennis, do you know if it's possible at all to get a windows default printer object reference in VBA ? I said printer object because I already have a function which returns the windows default printer name as a string.
The reason I ask is I thought if I can get a reference to a windows default Printer, then I can use that reference object to control the tray.
Do you think I am completely off the track here ?
Apr 13 2012, 12:20 PM
I can't contribute any more than the folks in your thread from a couple months ago
did, I'm afraid.
By the way, based on the tone of that thread, I was under the impression that you had figured out how to set the Windows default printer. Can't you set the default printer, then print the PDF?
Apr 16 2012, 05:34 AM
I couldn't find a way to control windows default printer to change printer trays using vba. Also, because the version of Adobe Reader on most user's machines are free, the option of printing via Adobe is also unavailable.
So for a temporary solution I set manually the printer tray settings on each user's machines. If I find a way of controlling the windows as opposed to application printer trays I will post it here.
Thanks again for your tips.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here