HKFuey
asked on
VBA to change default printer
I want to change my default printer, print some labels then change it back.
I found this but it does not work (See error Pic)
Can anyone help?
I found this but it does not work (See error Pic)
Dim prt As Printer
' Get current default printer
Set prt = Application.Printer
' Set default printer
Application.Printer = Application.Printers(strPrinterName)
Can anyone help?
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Hi Boyd,
Re: How are you setting the value for strPrinterName?
Dim strPrinterName
strPrinterName ="My Printer Name"
I only have 4 reports and 2 label printers, I'm beginning to think the simplest way is to set the printer on the report and just let the user choose which format they want.
Re: How are you setting the value for strPrinterName?
Dim strPrinterName
strPrinterName ="My Printer Name"
I only have 4 reports and 2 label printers, I'm beginning to think the simplest way is to set the printer on the report and just let the user choose which format they want.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks for the help.
I use the code you posted to set the applicant print all the time.
The key to the code is how you set the value in strPrinterName.
How are you setting the value for strPrinterName?
TIP:
If the label printer will not change, set the report to always print to that printer not the default printer..