Find # of Pages in First Section of Document

E

ehale

Hello,

I need to determine the number of pages in the first section of a document
using vba. Anyone know how? Any help is very appreciated, thanks!
 
J

Jay Freedman

Hello,

I need to determine the number of pages in the first section of a document
using vba. Anyone know how? Any help is very appreciated, thanks!

ActiveDocument.Sections(1).Range.Information(wdActiveEndPageNumber)
 
T

Tony Jollans

That only works for the first section. For others you must subtract the end
page of the previous section, for example ..

ActiveDocument.Sections(2).Range.Information(wdActiveEndPageNumber)-ActiveDo
cument.Sections(1).Range.Information(wdActiveEndPageNumber)

I kind of think there ought to be a better way but don't know it. Also be
aware that this will not always give the same answer as {SECTIONPAGES} if
you have continuous section breaks.
 

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