how to know the pagenumber of a paragraph

R

Ralf

hi all,

i have to insert some pages in case of even or odd pagenumber of a paragraph
before the paragraph.

How can i find out the actual pagenumber of a paragraph?
 
L

Lene Fredborg

The following code will return the page number of end of the first paragraph
in the selection:

Selection.Paragraphs(1).Range.Information(wdActiveEndPageNumber)

--
Regards
Lene Fredborg - Microsoft MVP (Word)
DocTools - Denmark
www.thedoctools.com
Document automation - add-ins, macros and templates for Microsoft Word
 
K

Klaus Linke

Lene Fredborg said:
The following code will return the page number of end of the first
paragraph
in the selection:

Selection.Paragraphs(1).Range.Information(wdActiveEndPageNumber)

.... but maybe (if you don't need the empty page) you'd be better off
inserting an odd or even page break?

Regards,
Klaus
 
D

Doug Robbins - Word MVP

Use the .Selection.Information (wdActiveEndPageNumber) property.

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP
 
R

Ralf

Klaus Linke said:
.... but maybe (if you don't need the empty page) you'd be better off
inserting an odd or even page break?

i only know how to insertodd or even sections - and this happens that no
paenumber will insert for any empty page. But every page has to have a header
with logo and a footer with pagenumber.

Do you mean other method?

Regards
Ralf
 
K

Klaus Linke

.... but maybe (if you don't need the empty page) you'd be better off
Ralf said:
i only know how to insertodd or even sections - and this happens that no
paenumber will insert for any empty page. But every page has to have a
header
with logo and a footer with pagenumber.

Do you mean other method?

No, that's what I meant... and why I said it works if you don't need the
empty page.

You could insert the page break(s) by macro as you planned (using
Selection.Information to determine if it's necessary, as Doug and Lene
said).

Or you could use a field to force the empty page, as this article by John
McGhie explains:
http://word.mvps.org/FAQs/TblsFldsFms/InsEvnPgEndChap.htm

I'd probably use the field myself, because the empty page goes away/is
inserted automatically if the page flow changes.

Gruß,
Klaus
 

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