Views:

Product: LABELVIEW, CODESOFT

Version: LABELVIEW Gold and CODESFOT Enterprise 2014 and Newer

 

To set the printer with a VB script, a data source specifying the printer will be required. Please see the attached CODESOFT label for an example including data sources

1. Create a new label with a When Printed variable called "Printer".

2. Right click on the label and select the document properties.

3. In the VB script tab, select the "OnAfterLoad" subroutine and enter the following VB script:

dim printerList, printer, i
Document.Variables.Item("Printer").PickListUse = true
set printerList = Document.Variables.Item("Printer").GetPickList

for i = 0 to printerList.GetSize
printerList.DeleteValue
next

for each printer in Application.PrinterSystem.Printers
printerList.AddValue printer
next

Document.Variables.Item("Printer").ValueFromPickList = true


4. Press OK, and then open the Properties for the "Printer" when printed data source.

5. In the OnChangeFieldData subroutine, add the following VB script:

Document.Printer.SwitchTo Value

6. Press OK and then save and reopen the label. You should now see the following when you press print: