'Selecting a printer from VBA
I have successfully created a temporary table that populates all current printers on the machine for a picklist of printers to print to. But, when I try and change the printer in the report I can't get it to reference the printer that I selected.
If I put this code straight into the on-load event of the report I am trying to run
Application.Printer = Application.Printers("\\CBMSRV\Shipping")
The report populates and when sent to the printer it goes to the printer in the code (\\CBMSRV\\Shipping in this example). But that is hardcoded and I want it to select from the drop-down box the user selects.
This is what I have tried, along with other versions and can't seem to find out what I am doing wrong.
Dim prN As String
prN = Forms!\[frmprinterselect\]!\[Combo0\]
Application.Printer = Application.Printers(prN)\
The current value of combo0 is \\CBMSRV\\Shipping (along with other values)
I have also tried changing the value of combo0 to \\CBMSRV\\Shipping and that doesn't work either.
Thank you.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
