Changing Printers in Visual Basic

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am looking for a way to change an individuals (users) default printer to another printer. Print a file and then reset back to the users original printer. Any suggestions?
 
Hi,

Add a reference to system.management.dll

Dim moReturn As Management.ManagementObjectCollection

Dim moSearch As Management.ManagementObjectSearcher

Dim mo As Management.ManagementObject

moSearch = New Management.ManagementObjectSearcher("Select * from
Win32_Printer")

moReturn = moSearch.Get

For Each mo In moReturn
Dim objReturn As Object
Debug.WriteLine(mo("Name"))
mo.InvokeMethod("SetDefaultPrinter", objReturn)
Next


Ken
 
Back
Top