jackg
asked on
printing in VB
how can I let a user select a printer without changing the default printer in the windows system control.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Don't use the CommonDialog to select the printer... It will set whatever printer is selected as the default printer... Do it yourself... for example:
Populate a listbox like this:
Dim X As Printer
For Each X In Printers
List1.AddItem X.DeviceName
Next
Then put this in the listbox double-click event...
For Each X In Printers
If X.DeviceName = List1.List(List1.ListIndex ) Then
Set Printer = X
Exit For
End If
Next
VB will then use whatever printer was double-clicked on when you use the Printer Object....
Cheers!
Populate a listbox like this:
Dim X As Printer
For Each X In Printers
List1.AddItem X.DeviceName
Next
Then put this in the listbox double-click event...
For Each X In Printers
If X.DeviceName = List1.List(List1.ListIndex
Set Printer = X
Exit For
End If
Next
VB will then use whatever printer was double-clicked on when you use the Printer Object....
Cheers!
Not only does common dialog change the default but often does NOT redirect the print to the newly selected printer for some reason too! After I changed the printer to the new choice then printed something it still went to the old default printer and when I exited and printed from someplace else I noticed that the selected printer from earlier was now the default THEN IT decided it was time to start using the selected printer hehehe. What trash!
Whats even scarier is how unlikely it is Microsoft will even bother to fix the common dialog to work as expected..
Whats even scarier is how unlikely it is Microsoft will even bother to fix the common dialog to work as expected..
Thanks for the points! Glad I could help!
Cheers!
Cheers!
ASKER