Determine when report printed to specific printer

M

Matt Williamson

I need to send a notification email when a report is printed to a specific
printer. I'm not sure how to determine when something is printed to a
specific printer. I'm doing this in vba in access 97 and I'm thinking API
will be needed, but I'm not sure what and the search terms for the archive
are just too broad until I figure out better search criteria.

-TIA

Matt
 
K

Karl E. Peterson

Matt said:
I need to send a notification email when a report is printed to a
specific printer. I'm not sure how to determine when something is
printed to a specific printer. I'm doing this in vba in access 97 and
I'm thinking API will be needed, but I'm not sure what and the search
terms for the archive are just too broad until I figure out better
search criteria.

Monitoring the print queue of a printer isn't too difficult, but it can be rather
involved. To see a VB implementation, have a look at
http://vb.mvps.org/samples/PrnInfo. Another approach might be using
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/gdi/prntspol_9sxa.asp,
though that gets difficult if your application needs to be doing other stuff too.
 
M

Matt Williamson

It's funny that you answered this. I've downloaded all of the examples on
your site and stuck them in an examples directory that I look through any
time I need help with something. The majority of the time, I find something
that I can modify to make work.
I was actually just looking at the example you mentioned before I saw this
<g>.

The only issue I'm running into is that you enumerate the printers through
the VB printers collection in your code, but Access 97 VBA doesn't have a
printers collection that I know of. I'm pretty sure I've seen a class module
that replaces the Printer object, but I don't remember where. Do you
remember seeing it out in the ether somewhere?

TIA

Matt
 
K

Karl E. Peterson

Hi Matt --
It's funny that you answered this. I've downloaded all of the
examples on your site and stuck them in an examples directory that I
look through any time I need help with something. The majority of the
time, I find something that I can modify to make work.
I was actually just looking at the example you mentioned before I saw
this <g>.

Kewl. :)
The only issue I'm running into is that you enumerate the printers
through the VB printers collection in your code, but Access 97 VBA
doesn't have a printers collection that I know of. I'm pretty sure
I've seen a class module that replaces the Printer object, but I
don't remember where. Do you remember seeing it out in the ether
somewhere?

Ummm, same example? <vbg>

There was a bug in the VB5 printers collection (scroll down to "Bug in VB5 Printers
Collection", same page <G>), where if there were more than "so many" printers
installed, not all would be included. That class (CPrinters) ought to work in VBA, I
believe.

Thanks... Karl
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top