Set number of copies

C

Chris Carroll

I'm sending some info from Access to word which is working fine. the
problem i have is i can't figure out the code to set the number of copies
for print. I don't want to automatically print the document, just set the
number of copies so when the user selects the print button, the right, 2
copies are printed by default for that document.

Oh yeah, i'm using VBA for this.

Thanks,
Chris
 
W

Wei-Dong Xu [MSFT]

Hi Chris,

Very good question!

You can write codes below to print the documentation.
'--Code begin-----
Dim iPageNumber As Integer
iPageNumber = 2
ActiveDocument.PrintOut copies:=iPageNumber
'--Code end----

Furthermore, you can also specify more arguments for printing. For example, print the first three pages of the document in the active window.
ActiveDocument.ActiveWindow.PrintOut _
Range:=wdPrintFromTo, From:="1", To:="3"

Please feel free to let me know if you have any further questions.

Does this answer your question? Thank you for using Microsoft NewsGroup!

Wei-Dong Xu
Microsoft Product Support Services
Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
 
C

Chris Carroll

Yes, I tried this and it works as intended. the problem is I don't want it
to print automatically. I'm keeping the word doc open so the user can make
any additional changes and then just hit the print button. I would like to
set the document to automatically print 2 copies without the user having to
specify that in the print properties. Is there a way to do this? the code
below automatically prints the document without letting the user make
changes after opening the word document.

Thanks,
Chris


Wei-Dong Xu said:
Hi Chris,

Very good question!

You can write codes below to print the documentation.
'--Code begin-----
Dim iPageNumber As Integer
iPageNumber = 2
ActiveDocument.PrintOut copies:=iPageNumber
'--Code end----

Furthermore, you can also specify more arguments for printing. For
example, print the first three pages of the document in the active window.
 
W

Wei-Dong Xu [MSFT]

Hi Chris,

Thank you for replying!

For your scenario, I'd suggest you can use inputbox method to tell the user inputing one number for copies. I write example codes for you.

'code begin---
On error resume next
Dim iPageNumber as Interger
iPageNumber = InputBox("How many copies do you want to print?")

If iPageNumber = 0 Then
MsgBox "O copy"
Else
MsgBox iPageNumber & " copies will be printed"
End If
'code end---

Please note we should use "on error resume next" here, because vba will throw error for non-number input. If we use "On error resume next", inputbox
will return 0 if the customer gives a non-number input.

Please feel free to let me know if you have any further questions.

Does this answer your question? Thank you for using Microsoft NewsGroup!

Wei-Dong Xu
Microsoft Product Support Services
Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
 
C

Chris Carroll

Yes, i think i finally have it figured out.

thanks for your help!

Chris


Wei-Dong Xu said:
Hi Chris,

Thank you for replying!

For your scenario, I'd suggest you can use inputbox method to tell the
user inputing one number for copies. I write example codes for you.
'code begin---
On error resume next
Dim iPageNumber as Interger
iPageNumber = InputBox("How many copies do you want to print?")

If iPageNumber = 0 Then
MsgBox "O copy"
Else
MsgBox iPageNumber & " copies will be printed"
End If
'code end---

Please note we should use "on error resume next" here, because vba will
throw error for non-number input. If we use "On error resume next", inputbox
 
W

Wei-Dong Xu [MSFT]

Hi Chris,

Thank you for replying!

You are always welcome!

Thank you once more for using Microsoft NewsGroup!

Wei-Dong Xu
Microsoft Product Support Services
Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
 

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