I am trying to select a printer from the printers installed on my machine which happens to be a label printer, and print a few details to it. However, My vb program seems always to print to the default printer no matter what printer i select. I am using the same code as given in the vb help files, but this doesn't seem to work.
Here is the code im using:
Dim ret As Integer
ret = MsgBox("Are You Sure You Want To Print Label?", vbQuestion + vbYesNo, "Print Confirm")
If ret = vbYes Then
'the following code will select the correct printer'
Dim X As Printer
For Each X In Printers
If X.DeviceName = "Label Printer" Then
Set Printer = X
'Print the details to the printer
Printer.Print "Line 1"
Printer.Print "Line 2"
Printer.Print "Line 3"
Can anyone see the problem?
When i set the label printer as default, this works fine!