Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using wdDialogFilePrint

Status
Not open for further replies.

SiPearson

Programmer
Apr 3, 2002
3
GB
Hi I'm using the following code:

Dim oDlg As Dialog

Set oDlg = Dialogs(wdDialogFilePrint)
With oDlg
.Show
iNoCopies = .numcopies
End With
Set oDlg = Nothing

to allow a user to print a document. What I want is to capture the number of copies of a document, but when I use .show, .numcopies is always 1. If I use .display however, numcopies has the correct value, but the document does not print. I'd be grateful if anyone could help me capture the info I need and print the document.

Many thanks
Simon
 
I tried your code with some modifications and I got the number of copies via a message box.
Where are you declaring your iNoCopies variable?
Where are you checking the value of the same variable?

[tt]Option Explicit

Sub test()
Dim oDlg As Dialog
Dim iNoCopies As Long

Set oDlg = Dialogs(wdDialogFilePrint)
With oDlg
.Show
iNoCopies = .numcopies
End With
Set oDlg = Nothing

MsgBox iNoCopies
End Sub[/tt]
 
Justin,

I get a number returned but it is always 1, I'm assuming you'll get the same if you try to print more than one copy. At the moment I'm declaring the var the same location as you and viewing in a message box like you are.

The end goal is to be able to record in a db the number of pages and copies printed so the firm I work for (law firm) can claim back the cost of printing.

Thanks alot for your help,
Simon
 
Simon,

I tried the code I posted again and printed 3 copies.
I got the number 3 in the message box.

Can you post your code so that we might try to find where the problem is?
 
Justin,

after much messing about I've found the problem. We use a document management system called iManage which interacts with Word. When the interaction is on, the dialog returns the incorrect information, when its off I get the write values returned. Its very odd, and the next thing I've got to do is ask iManage what they are doing.

Thanks for all your help.
Simon
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top