Printer change code

F

f2rox

I am using the following code on a button to print form to a PDF printer
rather than the default printer
(the code is from
http://www.members.shaw.ca/AlbertKallal/msaccess/msaccess.html)
' get current default printer.
strDefaultPrinter = Application.Printer.DeviceName

'switch to printer of your choice.
Set Application.Printer = Application.Printers("Adobe PDF")
DoCmd.PrintOut acSelection
Set Application.Printer = Application.Printers(strDefaultPrinter)

My problem is that if i cancel the printout, i don't change back to my
default printer.
How do i fix this?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top