How to force a page break???

N

Nick

Hello,

How do I force a page break at any given point with VB in a word document?

I have tried :

Selection.Paragraphs(1).PageBreakBefore = True

but that doesn't work. That makes a new page at every paragraph. But
when I set the number higher I do not get any page break. Any thoughts?

Thanks,

Nick
 
H

Howard Kaikow

You are telling the code to put a page break only before the 1st para in the
current selection..
You need to adjust the code to affect other paras. Best way to do this
depends on the details of your code.
 
T

Tony Strazzeri

Hi Nick,

When not sure I record a macro to do what I want then look at the
codee. In this case if you just insert a pagebreak at the cursor
location you will get the following code.

Selection.InsertBreak Type:=wdPageBreak

The code you has sets the paragraph format to always put in a page
break at the start of that paragraph. ie equivalent to the pagebreak
before option in the Line and page breaks tab of Format|Paragraphs,
which I suspect is not what you want.

Cheers
TonyS.
 

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