BrainStorm
asked on
Set a printer as the default printer
How is it possible to set (by code and not using a common dialog) a printer as the default printer?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
what is the "Printer" object... how do i reference it?
add a listbox and add this code:
Dim P As Printer
For Each P In Printers
List1.AddItem P.DeviceName
Next
'after that, the user cans select one of them, then:
Private Sub List1_Click()
Dim P As Printer
For Each P In Printers
If P.DeviceName = List1.Text Then
Set Printer = P
Exit For
End If
Next
'now selected printer is the default printer
Printer.Print "MY TEXT"
Printer.EndDoc
End Sub