PDA

View Full Version : Specify paper tray



daniels012
10-24-2012, 07:20 AM
I am trying to add VBA to specify a paper tray to print on letterhead from our copier. Is there VBA that can make this happen?

I have posted on Mr. Excel as well. I have not had one reply.
http://www.mrexcel.com/forum/excel-questions/665705-specify-paper-tray.html
Thank You

Svet B.
10-24-2012, 10:29 AM
I don't believe this is doable in Excel. However, this is doable in Word (VBA and API). Let me know, if interested.

Cheers

Kenneth Hobs
10-24-2012, 10:47 AM
Svet, VBA is VBA so post your API solution. I would do it that way too but have not had time to look it up.

daniels012
10-24-2012, 11:07 AM
Let's give it a try

Svet B.
10-24-2012, 11:42 AM
daniels012, Kenneth

I attach a .doc file having a button which when clicked displays a form with the available trays. Double-clicking a tray in the list sets this tray. Again this code will only work with Word. The code is not fully mine. The original is from Microsoft KB article Q194789. Which was then adapted and I worked on it to make it work with Word 97. Also, this is just a test file I did when bidding on a project, that's why it may not look very user friendly.

Notes:
1. GetPrinterModule contains the API call and its utilization.
2. The UserForm frmPrinterInfo holds the VBA code to set a tray.
3. I presume you are well experienced with VBA, so I don't post here detailed explanations. If however, this is needed, please let me know and I'll do so.