Mailmerge printing different paper tray multiple sections per print job

  • Thread starter craig friend via OfficeKB.com
  • Start date
C

craig friend via OfficeKB.com

Doug was VERY helpful and provided me with a macro that would run from the
merged document and print each record as a separate job. The problem I ran
into was that the template itself actually contains 3 sections per record. So
the macro;

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


Functions properly however, I beleive it's treating each section as a
separate print job. I need to somehow get it to print after every 3rd
section or determine another way of splitting up the jobs.

Any help would be greatly appreciated!
 
P

Peter Jamieson

As an interim suggestion, how about adjusting the range of sections, e.g.


Dim i As Long
For i = 1 To ActiveDocument.Sections.Count Step 3
ActiveDocument.PrintOut Range:=wdPrintFromTo, From:="s" & i, To:="s" &
trim(cstr(i+2))
Next i

Peter Jamieson
 
C

craig friend via OfficeKB.com

Thanks for the suggestion...I'll have to try that one.
I actually added two other variables

Dim i As Long
Dim k As Long
Dim j As Long

k=1
j=3

For i = 1 To ActiveDocument.Sections.Count
ActiveDocument.PrintOut Range:=wdPrintFromTo, From:="s" & k, To:="s" & j
k=k+3
j=j+3

Next i
 
C

craig friend via OfficeKB.com

Correction:

Dim i As Long
Dim k As Long
Dim j As Long

k=1
j=3

For i = 1 To ActiveDocument.Sections.Count/3
ActiveDocument.PrintOut Range:=wdPrintFromTo, From:="s" & k, To:="s" & j
k=k+3
j=j+3

Next i
 
P

Peter Jamieson

If it works, it works. but just out of interest, why not use the "Step"
keyword in the For statement? as I suggested? It just seems a bit more
straightforward to me.

Peter Jamieson
 
C

craig friend via OfficeKB.com

Peter...thanks again!

It did work...but the your's is much cleaner. I just wasn't aware of Step
keyword.

Thanks again for all your help!
 

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