Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Printer Problem
I am using the Call CopyPrintData(ActiveSheet) to print. There are times when the printer is offline or defined at remote locations when the call to CopyPrintData(ActiveSheet) task creates a continues hourglass and will not complete. Is there away to build logic if the call CopyPrintData(ActiveSheet) task takes more than 45 seconds to end the task? Please help me with logic to resolve this issue. Thank you vey much. |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Printer Problem
You could ping the printer by its IP address to determine if it is online
Sub Ping() Set objPing = GetObject _ ("winmgmts:{impersonationLevel=impersonate}"). _ ExecQuery("select * from Win32_PingStatus " & _ "where address = '16.37.100.16'") For Each objStatus In objPing If objStatus.StatusCode = 0 Then MsgBox ("On-Line") Else MsgBox ("Off-Line") End If Next End Sub "Dean P." wrote: I am using the Call CopyPrintData(ActiveSheet) to print. There are times when the printer is offline or defined at remote locations when the call to CopyPrintData(ActiveSheet) task creates a continues hourglass and will not complete. Is there away to build logic if the call CopyPrintData(ActiveSheet) task takes more than 45 seconds to end the task? Please help me with logic to resolve this issue. Thank you vey much. |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Printer Problem
"Dean P." wrote:
I am using the Call CopyPrintData(ActiveSheet) to print. There are times when the printer is offline or defined at remote locations when the call to CopyPrintData(ActiveSheet) task creates a continues hourglass and will not complete. Is there away to build logic if the call CopyPrintData(ActiveSheet) task takes more than 45 seconds to end the task? Please help me with logic to resolve this issue. Thank you vey much. Sub PrinterTest() 'get active printer strPrinterName = Application.ActivePrinter 'connect to WMI on local computer Set objWMIService = GetObject("winmgmts:" _ & "{impersonationLevel=impersonate}!" _ & "root\cimv2") 'enumerate printers Set colInstalledPrinters = objWMIService.ExecQuery _ ("Select * from Win32_Printer") 'Printer status: '1 Other '2 Unknown '3 Idle '4 Printing '5 Warmup '6 Stopped printing '7 Offline 'get active printer status For Each objPrinter In colInstalledPrinters If InStr(strPrinterName, objPrinter.Name) Then Debug.Print objPrinter.Name Debug.Print "Network printer: " & _ (objPrinter.Local And objPrinter.Network) If objPrinter.PrinterStatus = 1 _ Or objPrinter.PrinterStatus = 2 Then Debug.Print "Printer not responding" Else Debug.Print "Printer status OK" End If End If Next End Sub Hope this helps. -- urkec |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
problem printing to HP color printer | Excel Worksheet Functions | |||
members on my network printer not able to print to default printer | Excel Discussion (Misc queries) | |||
printer problem | Excel Discussion (Misc queries) | |||
Printer problem | Setting up and Configuration of Excel | |||
Problem sending merge info to printer | Excel Programming |