Tuesday, 27 October 2015

Changing the default printer

It's a common question - how do you control what printer is used in your application? Especially if you don't want to use the default printer?

Access 2000 introduced the Application object which, amongst many other things, has a Printer property that can be easily used to set and change the current default printer. Here's how you might use it:

Dim prt As Printer 'Define a printer variable
Set prt = Application.Printer 'Set the variable to the current default printer
Application.Printer = Application.Printers("\\YourPrintServer\YourPrinter") 'Change the default printer
'Do whatever printing activities you want here
Application.Printer = prt 'Don't forget to set back to the user's original default printer

Personally, I find this most useful for printing things to my PDF queue which, needless to say, isn't my default printer. Speaking of which, if you're looking for a free PDF print queue tool, let me save you looking as I've tried dozens. The best, in my view, are Cute PDF and Bullzip - not only are they properly free (no nags or adverts), they’re very easy to use and produce smaller PDFs than lots of comparable products.

No comments:

Post a comment