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!
Thanks
http://www.freevbcode.com/ShowCode.asp?ID=3646
http://pubs.logicalexpressions.com/Pub0009/LPMArticle.asp?ID=132