SetWindowPrinter() Function
- Last UpdatedFeb 21, 2017
- 1 minute read
At run time, you can set the printer you want to use with the SetWindowPrinter() function.
Note: The printer set with this function is also the printer that is used with the PrintHT() function.
Syntax
SetWindowPrinter (printername)
Parameters
printername
The name of the printer, either as network share or as printer name as it appears in its property window. A literal string value, message tagname, or string expression.
Example(s)
In this example, PRTSRV1 is the node name and PRT22SW1 is the share name given to the printer.
SetWindowPrinter("\\PRTSRV1\PRT22SW1");
In this example, Epson LX-300 is the name of the printer as seen in the Properties window of the printer.
SetWindowPrinter("Epson LX-300");
In this example, MyPrinter is a message tag containing the name of an installed windows printer or the path to a shared network printer.
SetWindowPrinter(MyPrinter);