troubleshooting Question

How can I Set Printer Page size (based on available sizes) without Printer Dialog

Avatar of wehoit
wehoit asked on
Visual Basic Classic
6 Comments1 Solution549 ViewsLast Modified:
I need to be able to set the paper size for a printer without using the Printer Dialog box, based on the available paper sizes for the selected printer.

For example, in code, I'd like to do the following:

1) Retrieve the paper sizes available on the active printer (Printer)
2) Loop through the available size names to match a requested name (e.g. if papersize="Envelope #9")
3) When (if) I find a match, set the printer to the matched paper size.

So that if the printer default is "Letter" but I want to print to "Envelope #9", I can set the active Printer, loop through the paper sizes, and when I find "Envelope #9", set it and then print.

Basically, I want to mimic the Printer Dialog, but all in code.

*****  What's most important is that if I happen across a printer with non-standard page sizes, I should be able to pick them from a 'list', almost as if I were using the printer dialog
For example, a printer may use "Architectural D" wihch is not a windows standard size, but I should still be able to match it from the available page sizes and then set it on the printer.

Please provide code which does what I need - do not point me to a link which has some of the parts...after all - you're the expert!


Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 6 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 6 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros