Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Default printer

Status
Not open for further replies.

DUF

Technical User
Mar 10, 2001
107
IE
Hi,
I am learing VB6 and neet help with printers
How can I make my VB6 program change the default printer to the one it wants and change it back again when it's finished
Can this be done with code and not to use the Printer Dialog Box.

Thanks

a
 

Hi,

This sould do the trick...

------------------------------------------------------
Dim P As Printer, OldP as string
OldP = Printer.DeviceName
For Each P In Printers
If P.DeviceName = "\\HOEK\castle" Then
Set Printer = P
Exit For
End If
Next
'do your printing here
For Each P In Printers
If P.DeviceName = OldP Then
Set Printer = P
Exit For
End If
Next
------------------------------------------------------


Sunaj
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top