|
Function ActivePrinterStatus() As String
Dim ActivePrinterName As String, dyj As String
Dim objWMI As Object, colPrinters As Object
Set objWMI = GetObject("winmgmts:(impersonationLevel=impersonate)!\\.\root\cimv2")
Set colPrinters = objWMl.ExecQuery("Select * from Win32_Printer")
dyj = Application.ActivePrinter
ActivePrinterName = Left(dyj, InStr(dyj, "在") - 1)
For Each objPrinter In colPrinters
If objPrinter.Name = ActivePrinterName Then
Select Case objPrinter.PrinterStatus
Case 3
ActivePrinterStatus = "空闲"
End Select
Exit For
End If
Next
End Function
|
|