-
I want an app to only change the printer default within the application. If I use the common dialog, I can set .defaultprinter=False to stop the Windows default printer from changing, but then my local printer isn't changed either!
Code:
Private Sub mnuFPrtSetup_Click()
cmdlg.PrinterDefault = False
cmdlg.Flags = cdlPDPrintSetup
cmdlg.ShowPrinter ' display Printer Setup cdlg box.
VPrint.DeviceName = Printer.DeviceName
End Sub
What can I do to change printers and not change windows defaults?
-
I think all that you can do is to get the default printer in a variable, select the printer with the commondialog control (which then set the default to the printer that you have selected) and set the default printer back to the printer in the variable when you are done.
-
I guess I need more help. If I change the printer within the app, I don't want the user to have to change it each time the app is opened, and I also don't want it to change the Windows default printer. What are some standard ways of persistence, either in the registry or in a database? Does anyone have working examples of this? I apologize for my lameness, but everything I have tried ultimately changes the windows default, which is unacceptable.
-
No problemo!
Code:
Private sDefaultPrinter$
Private Sub Form_Load()
sDefaultPrinter = GetSetting (app.Title, "Options", "DefaultPrinter")
if sDefaultPrinter = "" Then
cmdlg.PrinterDefault = False
cmdlg.Flags = cdlPDPrintSetup
cmdlg.ShowPrinter ' display Printer Setup cdlg box.
VPrint.DeviceName = Printer.DeviceName
sDefaultPrinter = VPrint.DeviceName
End Sub
Private Sub Form_Unload(Cancel As Integer)
SaveSetting app.Title, "Options", "DefaultPrinter", sDefaultPrinter
End Sub
Hope you can work it out ;)