Set to default printer

Jake975

Board Regular
Joined
Feb 9, 2020
Messages
114
Office Version
  1. 2016
Platform
  1. Windows
How do i set this code to change the "default" printer instead of manually configuring the printer name?
VBA Code:
Sub prit()
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
    & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
 
Set colInstalledPrinters = objWMIService.ExecQuery _
    ("Select * from Win32_Printer Where Name = 'ET0021B73612A4'")
 
For Each ObjPrinter In colInstalledPrinters
    ObjPrinter.resume
Next
End Sub
 

Excel Facts

Last used cell?
Press Ctrl+End to move to what Excel thinks is the last used cell.
i figured it out with that website and Microsoft website as well thanks
Do you know how to cancel specific documents with a given name?
 
Upvote 0
Do you know how to cancel specific documents with a given name?

I am not sure what this means, can you elaborate?
 
Upvote 0
How would I cancel specific documents in the printer spool with a given name
 
Upvote 0
That is outside the realm of my knowledge. Maybe someone else can answer it.
regards, JLG
 
Upvote 0

Forum statistics

Threads
1,215,352
Messages
6,124,455
Members
449,161
Latest member
NHOJ

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top