Solved Adding a blank page if section has a odd number of pages

Microsoft Office 2013 professional produ...
March 16, 2015 at 01:28:12
Specs: Windows 8.1
Hello all

At Work we do a lot of mail merging and often we have up to a 100 letters, containing from 4 to 7 pages each. At the moment we print those letters one-sided, but that is a lot of paper and that could be done better if we could print double-sided. The problem is, that some letters in a mail merge has a odd number of pages and then the next letters first page will be on the backside of the last letters last page if we print double-sided.

I have been looking at solutions, but I can't get them working.

Here are my approaches so far:

1. Merge the letters as usual, then running a macro that devides the letters up into individual printing jobs and sending those to the printer. This did almost Work, but the individual printing jobs did get mixed up and some jobs didnt get to the printer, so this is not the way I want to go.

2. Merge the letters as usual, then running a macro that changes the section breaks from NewPage breaks to OddPage breaks. The theory of this (as far as I know) is that when you replace the newpage breaks with the oddpage breaks on and odd numbered page, then Word inserts a blank page after that page, so that the switching between odd and even page numbers continues. The macro I have tried was this:

Sub PrinterMacro()


Dim iSec As Integer
 For iSec = ActiveDocument.Sections.Count To 2 Step -1
 With ActiveDocument.Sections(iSec).Range.PageSetup
 If .SectionStart = wdSectionNewPage Then
 .SectionStart = wdSectionBreakOddPage
 End If
 End With
 Next iSec

End Sub

But that code returns an Run time error 5148, saying the wdSectionBreakOddPage has to be a number from 0 to 4. When I hover the mouse over it in break-mode it says the number is 5.

What could be the problem here? Is there an easier or another way to do it?

Thanks very much in advance

/Jacob


See More: Adding a blank page if section has a odd number of pages

Report •


#1
March 16, 2015 at 07:19:26
Let me start by saying that we don't get a lot of Word macro questions in this forum and that AFAIK there are no Word macro experts that hang out here.

I can help with Excel macros but I'll toss out a suggestion or 2 anyway...

re: "1. Merge the letters as usual, then running a macro that devides the letters up into individual printing jobs and sending those to the printer. This did almost Work, but the individual printing jobs did get mixed up and some jobs didnt get to the printer, so this is not the way I want to go."

Nothing personal, but my guess is that there is a problem with the macro and that this might be the best way to go. Without seeing the code, it's hard to say what is going on. We've all seen some strange things happen with VBA code, so maybe that approach won't work, but it seems like the easiest. Perhaps if you share the code it might be something we can look at/test.

re: "2. Merge the letters as usual, then running a macro that changes the section breaks from NewPage breaks to OddPage breaks. The theory of this (as far as I know) is that when you replace the newpage breaks with the oddpage breaks on and odd numbered page, then Word inserts a blank page after that page, so that the switching between odd and even page numbers continues. The macro I have tried was this:"

Again, not being a VBA for word expert, I'm not sure if this will accomplish your goal, but the error can be eliminated by changing the following instruction from:

.SectionStart = wdSectionBreakOddPage

to:

.SectionStart = wdSectionBreakOddPage - 1

Just a guess, but maybe Word wants all "OddPage Section Breaks" to actually occur at the end of the previous even page.

If that doesn't help, you might consider this news group, which is dedicated to Word:

https://groups.google.com/forum/?hl...

Click Here Before Posting Data or VBA Code ---> How To Post Data or Code.


Report •

#2
March 17, 2015 at 02:19:07
That I can't get working. I would really like to just insert a blank page at the end of an odd numbered page. I will try to post in the forum you have mentioned and return if I find any answers there. Thanks for you time.

Report •

#3
March 17, 2015 at 14:36:58
✔ Best Answer
I have found a solution that seems to work and thought I would share it here:

https://groups.google.com/forum/?hl...


Report •

Related Solutions

#4
March 17, 2015 at 14:43:04

Report •

Ask Question