hi my program is need to print different forms but each forms must use different printer and all printers was connected to my pc via usb port, my problem is if i want to print a form A i will click the command box then it will use the EPSON printer, if form B use CANNON, and in form C it will use BROTHER as its default printer. Can u help me to set the dafault printer before the form will be printed. Thanks.

Edited by pritaeas: Moved to VB.

4 Years
Discussion Span
Last Post by rishif2

you just need the following

Dim p As VB.Printer
For Each p In VB.Printers
If p.DeviceName = "EPSON" Then
Set Printer = p
End If

i hope that you can use the above code according to your suitability.one more thing that may help you is that use of commondialog boxe to choose the printer but i think the above code will be more suitable as we need not to select the printer again and agian whenever we want to print.

hope this helps you...


Epson is a make of printer.
You put the name of the printer you want where it says Epson.


For Operating Systems through Vista:
Click your start button.
If "Printers" is listed then click on it.

If "Printers" is not listed go to Control Panel and click Printers from Control Panel.

From the printers screen note the names of the available printer. Find the three you need and make sure you use the exact name listed under Printers.
Hope that helps.


you can easily determine the printers that are in your system
use the following code:-

Dim p As VB.Printer
For Each p In VB.Printers
MsgBox p.DeviceName

you will get every printer name which is in your system.

hope this helps you . . .

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.