Reg. MS Word Add-in

V

vs.parthasarathy

Hi,

I need to get the print details(number of pages, page range) in my add-
in, when printing is completed.
Is there any callback that can be handled in add-ins to get these
details?

Thanks,
VSP
 
J

Jonathan West

Hi,

I need to get the print details(number of pages, page range) in my add-
in, when printing is completed.
Is there any callback that can be handled in add-ins to get these
details?

Thanks,
VSP

This isn't going to be all that easy. It is a substantial bit of coding, but
I think it is all doable.

First of all, the good news. There is code out there you can use to get the
details of the current status of the print queues. Take a look here

http://vb.mvps.org/samples/project.asp?id=PrnInfo

The trick will be knowing when to use the code. Probably the simplest way is
to hook off the DocumentBeforePrint event, then wait until printing is
complete (at least the part that involves senting the Word document to the
print queue) and then query the queue to get the print job details.

To make use of the DocumentBeforePrint event, take a look at this article

Writing application event procedures
http://www.word.mvps.org/FAQs/MacrosVBA/AppClassEvents.htm

To find out whether Word has finished printing, take a look at this article

How to find out whether Word has finished printing
http://www.word.mvps.org/FAQs/MacrosVBA/WaitForPrint.htm


The job will be bolting all this together and making it work. For instance,
you may well need to have a timer object raise en event after a delay of a
few seconds after the DocumentBeforePrint event so that you can be sure that
Word has actually started printing and you don't check that it has stopped
before it has even got started. This article might help you with defining
and using a suitable timer

http://vb.mvps.org/samples/project.asp?id=TimerObj
 

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