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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VB6 how to save & restore default printer settings?

Status
Not open for further replies.

Tiffanyc

Programmer
Mar 11, 2004
4
US
Hi. I have a VB6 application that changes the default printer. Before the default printer is changed, I'd like to save the original default printer settings. Then after the application is done running I want to restore the original default printer settings back. How can I do this?

Thank you!
 
If you use something along the following lines, you should end up 'storing' details of the default printer in Prt

Code:
  Dim Prt as Printer, DefaultPrt as Printer

  For Each Prt In Printers
    If Prt.DeviceName = Printer.DeviceName And _
       Prt.Port = Printer.Port And _
       Prt.DriverName = Printer.DriverName Then
      Set DefaultPrt = Prt
      Exit For
    End If
  Next

Then, to restore the default:

Code:
Set Printer=Prt
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top