Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / December 2004

Tip: Looking for answers? Try searching our database.

MS Word Print 3 Pages at a time

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
ksenzano - 30 Nov 2004 16:25 GMT
I have this printer that staples every print job.
I have this mail merge document where every three pages is directed to a new
recipient.
If I send the mail merge document to the printer it will print the entire
128 pages and staple them all together.
What I want is the printer to staple every three pages together. The printer
Konica has no solution for it. And I wanted to know if MS Word via VBA or
anything can send every three pages of its document as a separate print job.
Peter - 30 Nov 2004 17:48 GMT
Something like this might help:

Dim iPageFrom As Integer
Dim iPageTo As Integer
Dim iPages As Integer

iPages = ActiveDocument.BuiltInDocumentProperties("Number of pages")

For iPageFrom = 1 To iPages Step 3
 
 iPageTo = iPageFrom + 3
 
 If iPageTo > iPages Then iPageTo = iPages
 
 Call ActiveDocument.PrintOut(Background:=True, Range:=wdPrintFromTo, From:=CStr(iPageFrom), To:=CStr(iPageTo))
 
Next iPageFrom

hth,

-Peter

> I have this printer that staples every print job.
> I have this mail merge document where every three pages is directed to a new
[quoted text clipped - 4 lines]
> Konica has no solution for it. And I wanted to know if MS Word via VBA or
> anything can send every three pages of its document as a separate print job.
ksen - 30 Nov 2004 19:35 GMT
This is doing the trick, However I'm testing it with only 9 pages of the
merge document and it is printing out 7 pages (1,2,3,4,5,6,7 ) stapled then
it prints and staples pages (7,8,9)
So it only works for the last set of 3 pages.
Could you possible comment the script as I am very new to VB. And it seems
it could be a function/math issue.
Thank you very much Peter, you are a saver.
-K

> Something like this might help:
>
[quoted text clipped - 26 lines]
> > Konica has no solution for it. And I wanted to know if MS Word via VBA or
> > anything can send every three pages of its document as a separate print job.
Peter - 30 Nov 2004 20:46 GMT
Hmm.... I checked it out again and it doesn't look like it should be behaving as you describe.
I found one error: I was setting iPageTo = iPageFrom + 3, when it should be +2 because the page range is inclusive.

Dim iPageFrom As Integer
Dim iPageTo As Integer
Dim iPages As Integer

''' get the number of pages in the document from the document properties
iPages = ActiveDocument.BuiltInDocumentProperties("Number of pages")

''' iterate through the pages, going every three
For iPageFrom = 1 To iPages Step 3
 
 ''' set the page range to print.  It's inclusive, so just add two to the current page
 iPageTo = iPageFrom + 2
 
 ''' check to make sure we're not going to send an invalid page to the PrintOut command
 If iPageTo > iPages Then iPageTo = iPages
 
 ''' print the range of pages.  Use background printing so this doesn't take forever
 Call ActiveDocument.PrintOut(Background:=True, Range:=wdPrintFromTo, From:=CStr(iPageFrom), To:=CStr(iPageTo))
 
Next iPageFrom

Other than that, I don't see anything here that would cause the behavior you described.
I have been known to be blind sometimes, so perhaps someone else out there can eyeball it?

-Peter

> This is doing the trick, However I'm testing it with only 9 pages of the
> merge document and it is printing out 7 pages (1,2,3,4,5,6,7 ) stapled then
[quoted text clipped - 35 lines]
> > > Konica has no solution for it. And I wanted to know if MS Word via VBA or
> > > anything can send every three pages of its document as a separate print job.
Doug Robbins - 01 Dec 2004 02:21 GMT
See response in the other newsgroup to which you posted this.  You need to
print by Sections, not Pages.

As far as Word is concerned, your pages would be numbered p1s1, p2s1, p3s1,
p1s2, p2s2, p3s2, p1s3, p2s3, p3s3, etc.

Signature

Please respond to the Newsgroup for the benefit of others who may be
interested.   Questions sent directly to me will only be answered on a paid
consulting basis.

Hope this helps,
Doug Robbins - Word MVP

>I have this printer that staples every print job.
> I have this mail merge document where every three pages is directed to a
[quoted text clipped - 7 lines]
> anything can send every three pages of its document as a separate print
> job.
ksen - 01 Dec 2004 14:01 GMT
Thank you again Doug! Came by to tell Peter but I see you already have.
Wish you and Peter a good day!!!

> See response in the other newsgroup to which you posted this.  You need to
> print by Sections, not Pages.
[quoted text clipped - 13 lines]
> > anything can send every three pages of its document as a separate print
> > job.
Peter - 01 Dec 2004 17:56 GMT
Which other NG?  I'm interested to see the answer, too.

-Peter

> Thank you again Doug! Came by to tell Peter but I see you already have.
> Wish you and Peter a good day!!!
[quoted text clipped - 16 lines]
> > > anything can send every three pages of its document as a separate print
> > > job.
Doug Robbins - 09 Dec 2004 01:55 GMT
I think it was in mailmerge fields, but here is the code:

Dim i As Long
For i = 1 To ActiveDocument.Sections.Count
   ActiveDocument.PrintOut Range:=wdPrintFromTo, From:="s" & i, To:="s" & i
Next i

Signature

Please respond to the Newsgroup for the benefit of others who may be
interested.   Questions sent directly to me will only be answered on a paid
consulting basis.

Hope this helps,
Doug Robbins - Word MVP

Which other NG?  I'm interested to see the answer, too.

-Peter

> Thank you again Doug! Came by to tell Peter but I see you already have.
> Wish you and Peter a good day!!!
[quoted text clipped - 24 lines]
> > > print
> > > job.
Peter - 09 Dec 2004 20:13 GMT
Ah, ok.  I had tested on a "normal" document, just one with several pages, and it had printed as expected, every 3 pages.

-Peter

> I think it was in mailmerge fields, but here is the code:
>
[quoted text clipped - 6 lines]
>
> -Peter
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.