Access 2003 VBA - Change/Set Default Printer
I need to programmatically set/reset the default printer using Access 2003 VBA.
In searching around I found an example, but it doesn't work. This is what I'm trying
Code:
Dim prtDefault As Printer
Set Application.Printer = Application.Printers("\\ServerName\PrinterName")
Set prtDefault = Application.Printer
Ideally, of course, the actual printer name will be in a variable, but for testing purposes I'm actually hard coding it. Even hard coded, this code does not change the default printer.
I have a commondialog control on my Access 2003 form and I'm using the .ShowPrinter method. If I use that, and the user actually selects the desired printer, and clicks on the "Print" button, it does set the selected printer as default.
However, I need to do this behind the scenes (at least, that is my current requirement) with no user intervention.