Hi.... I would like to change the printer to printer (B) within the VB code and then print something on printer ( B)
and then change the printer back to printer (A).
I have tryed Printer.Device = Brother145 ... But I get Object required.
Please can you help........... Flippy.
VB6Printer
Flippy, try enclosing your printer name in quotes so it appears as a string (name of an object...) instead of an UnIdentified object like your code says...
Printer.Device = Brother145 - should be -
Printer.Device = "Brother145"
Brother145 not being in quotes is being interpreted as a Variable name of Brother145 which has no value. I can tell by the error message you're NOT using OPTION EXPLICIT as YOU REALLY SHOULD!! But that's another issue. I'd suggest reading a book or two, or better yet hire someone with experience to do the job. Especially if you want professional results..
Change the printer with VB code
Dim prt As Printer
For Each prt In Printers
If prt.DeviceName = "MyPrinterName" Then
Set Printer = prt
Exit For
End If
Next
Hope This helps
Post new comment