Link to home
Start Free TrialLog in
Avatar of rajesh_agr
rajesh_agr

asked on

Printer Online/Offline

Through my VB application I wants to test that printer is online/offline
before printing the report.
Could anyone please let me know how to test it?


Avatar of Dangeriz
Dangeriz
Flag of Taiwan, Province of China image

How are you printing the report?
Are you using the Printer object?
if you are using the Print object in VB then there ISN'T a method you can use which allows you check for printer online/offline status. It will just take send print commands to the default printer on that machine.

All you have to do to accommodate this is to use proper error handling...

Private Sub Command1_Click()
   
On Error GoTo ErrorHandler   ' Set up error handler.
   
   Printer.Print "Testing printer connectivity"   ' Send Print command.
   Printer.EndDoc
   
   Exit Sub
   
ErrorHandler:
   MsgBox "There was a problem printing to your printer." & vbCrLf & _
            "Please check your your printer connectivity."
   Exit Sub
End Sub
ASKER CERTIFIED SOLUTION
Avatar of zzzzzooc
zzzzzooc

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial