Check if a printer is working before sending a print job to it

We had a situation where a problem occurred because for some reason there was not communication between a users and printer.  Is there any way in code to check to see if that communication exists before sending a print job in code?  Currently, we are prompting the user with:
  If MsgBox("The current default printer is " & Application.Printer.DeviceName & ". Do you want to proceed?", vbYesNo) = vbNo Then      Exit Sub
  End If
To allow then to change the printer but this does not let us know if the communication exists.
troyvwAsked:
Who is Participating?
 
Gustav BrockCIOCommented:
Well, nearly exact what I wrote:

<quote>
NOTE: The system only checks the status when the system has a job to spool. Otherwise, the queue is considered "ready" because the queue can accept jobs, even if the hardware is in an error state. For example, if the last job that was printed used the last piece of paper, the operating system does not know this until the system tries to print again.
<snip>
.. a queue that displays "Ready" does not guarantee that your print job will complete successfully.
</quote>

The only reliable method is to print via an external true printer server - in "the old days" a Novell NetWare printer server. Today you would probably choose a Linux or Windows file/print server.
This will spool any print job to a queue until the printer is ready. The printer may be off-line, even physically disconnected; as soon as the printer is ready, the server starts printing from the queue. If a job is interrupted for whatever reason, it will be reprinted when the printer is brought back on-line.
One printer queue may service more than one physical printer. If one printer is busy or off-line, printing will be directed to the other printer.

/gustav
0
 
Gustav BrockCIOCommented:
Not that I know of.

Remember that Windows normally spools the print jobs. This means that applications then "see" the printer as ready because the spooler will accept the print job even before trying to send it on to the printer.

/gustav
0
 
Jim Dettman (Microsoft MVP/ EE MVE)President / OwnerCommented:
Here's a link to a MSKB article which contains the code you need:
http://support.microsoft.com/kb/202480 
JimD.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.