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

Posted on 2009-02-18
Last Modified: 2013-11-28
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.
Question by:troyvw
    LVL 48

    Expert Comment

    by:Gustav Brock
    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.

    LVL 56

    Expert Comment

    by:Jim Dettman (Microsoft MVP/ EE MVE)
    Here's a link to a MSKB article which contains the code you need:
    LVL 48

    Accepted Solution

    Well, nearly exact what I wrote:

    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.
    .. a queue that displays "Ready" does not guarantee that your print job will complete successfully.

    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.


    Featured Post

    Better Security Awareness With Threat Intelligence

    See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

    Join & Write a Comment

    User Beware!  This is a rather permanent solution to removing your email from an exchange server.  The only way to truly go back is to have your exchange administrator restore your mailbox from backups.  This is usually the option of last resort.  A…
    The new Microsoft OS looks great, is easier than ever to upgrade to, it is even free.  So what's the catch?  If you don't change the privacy settings, Microsoft will, in accordance with the (EULA) you clicked okay to without reading, collect all the…
    The viewer will learn how to use a discrete random variable to simulate the return on an investment over a period of years, create a Monte Carlo simulation using the discrete random variable, and create a graph to represent the possible returns over…
    The viewer will learn how to create a normally distributed random variable in Excel, use a normal distribution to simulate the return on an investment over a period of years, Create a Monte Carlo simulation using a normal random variable, and calcul…

    746 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    16 Experts available now in Live!

    Get 1:1 Help Now