Avatar of Glenn Stearns
Glenn Stearns
Flag for United States of America asked on

Printing Multiple Copies of Word Doc from Excel VBA

I am trying the following code snippet from inside Excel VBA to call and print a Word document. I want to print 11 copies of the document when this snippet runs:

Dim objWord As Object
Dim objDoc As Object
Set objWord = CreateObject("Word.Application")
objWord.Visible = False
If Weekday(Now()) <> vbSaturday And Weekday(Now()) <> vbSunday Then
For Each Item In Array("C:\Users\gstearns\documents\notes.docx")
Set objDoc = objWord.Documents.Open(Item)
objDoc.PrintOut
objDoc.Copies = 11
objDoc.Close
Next
End If
objWord.Quit

My question is: Is the code correct for printing 11 copies (the objDoc.Copies = 11 line in the code) or do I need to write it differently to get 11 copies of the document?

Thanks!

Glenn
Printers and ScannersVBAMicrosoft Word

Avatar of undefined
Last Comment
Glenn Stearns

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
Norie

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
Martin Liss

Try reversing these two lines.

objDoc.PrintOut
objDoc.Copies = 11
Glenn Stearns

ASKER
Thanks!
Martin Liss

Please don't forget to close this question.
All of life is about relationships, and EE has made a viirtual community a real community. It lifts everyone's boat
William Peck
Glenn Stearns

ASKER
Thanks!