Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations cowski on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

odd page + fields (Word VBA)

Status
Not open for further replies.

nikster

Computer
Sep 19, 2001
1
I'm writing a template for a manual. I want to ensure that each new chapter start on an odd- numbered page. This is proving unbelievably difficult.

1 - if i use Odd-Page Section Breaks, any blank even pages that are inserted do not have the page numbers or headers or footers printed - they don't even show up when the document is print-previewed. Is there any way to get page numbers, headers and footers to appear on these inserted blank pages ?

2 - I've tried inserting an IF field through VBA as follows:- { IF { =MOD({ PAGE },2) } = 0 "[page break]" " "} at the end of each chapter. But because each chapter is in a separate section, these fields only update one at a time each time I do an update fields orprint the document - so I have to do an update fields (or print) the same number of times as there are sections with one of these fields in, which is not possible in a big report with lots of sections and hence lots of these fields. This is made worse if the user pastes separately-prepared Chapters into the main document.

This seems to me to be such a standard requirement - starting each new chapter on an odd-numbered (right-hand) page that there must be a simple way of doing it.

Thanks
nikster
 
Replies continue below

Recommended for you

Hi,

I'm no expert on VBA and there may be a simple command.
However I could see a couple of solutions.

Why not: (this is not the code just the flow)
If page = odd then
Insert Pagebreak
Insert OddPagebreak
Else
Insert OddPageBreak
Endif

That way if the page were odd it would insert 2 page breaks to get you onto an odd page again and only 1 page break if you were on an even page.

Knowing me and my need for a good macro, another route I would take would to have a hidden text marker at the begining of the chapter. Then write a macro (started with a button on the toolbar for speed) which then looks for these markers and inserts a blank page then an odd page break if the page were odd or just an odd page break if it were even.

You could even have text after the hidden marker which it uses to create a section break and change the header and footer to reflect the new chapter.

Just a thought

Regards
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor