Detecting Print Dialog - Number of Copies

G

Gilroy

How can I, using the Word Object Model of Word XP, detect
when a user has the Print Dialog open -- And retrieve the
value he has specified in the 'Number of copies' property?

I've gained access to the values of
Word.Application.Dialogs.Count property, but I can't
determine if the last dialog opened is actually the Print
dialog ... and I can't determine the value of the 'number
of copies' property.

Any ideas?

Thanks, in advance, for your help.
 
J

Jezebel

If you know that the print dialog was used you can retrieve the count from
the properties of Dialogs(wdDialogFilePrint).NumCopies. However, determining
that the print dialog has been called is not so easy. You can trap the
DocumentBeforePrint event; but that is called also if the user has clicked
FilePrintDefault, in which case the dialog hasn't been used.

Another approach is to trap the print request itself by writing a macro
called FilePrint: in the macro you call the print dialog directly, then
retrieve and process the values as needed.
 
G

Gilroy

Hello Jezebel,

I don't see a .NumCopies property. This is what I can
see in my IDE intellesense:

Word.Application.Dialogs.Item
(Word.WdWordDialog.wdDialogFilePrint).

Then the following:
..Application
..CommandName
..Creator
..DefaultTab
..Display
..Execute
..Parent
..Show
..Type
..Update

How do I get to .NumCopies from here?

Thanks again for your help!!
 
J

Jonathan West

Hi Gilroy

You won't see the Numcopies property in intellisense. That is because the
Dialogs collection is a collection of late-bound objects, all different, so
that the editor doesn't know what to make available.

But if you type in the .NumCopies property into the code, it will work.
 

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