PDA

View Full Version : Can vba do the printer setting?



clif
12-25-2011, 07:16 PM
By using vba excel

I want to print on

1. both sized
2. short edge left
3. paper from drawer no 2


If vba cannot do that , what kind of programming can do that?

Aflatoon
12-26-2011, 03:36 AM
VBA can change advanced printer settings using calls to the Windows API - here (http://support.microsoft.com/kb/828638) is a sample in the Microsoft Knowledge Base. Basic settings like margins can be done using the PageSetup object.

mdmackillop
12-26-2011, 06:01 AM
My method is to create a "clone" of the printer and set its defaults to the output you are after. I found some code to switch printers and put it together here (http://www.vbaexpress.com/kb/getarticle.php?kb_id=528)

clif
12-27-2011, 07:15 AM
Where is set the printername or Dervice name?

My dervice name is "Canon MP170 Series Printer ->>IP_192.168.0.1_9100(usb_port1)"

And i don't know where to set the paper source and short edge left ?

mdmackillop
12-27-2011, 11:37 AM
Using my solution, these would be set in the printer settings accessed through control panel.

clif
12-27-2011, 10:44 PM
But where can set the following variable

1. both sized
2. short edge left
3. paper source

mdmackillop
12-28-2011, 05:34 AM
Check the printer manual and help files.