wdActiveEndPageNumber

Z

zSplash

Maybe the code is not executing too fast, but for some reason the following
code gives me a false numPages:
Set oRng = ActiveDocument.Characters.Last
numPages =
ActiveDocument.Range.Information(wdActiveEndPageNumber)
For x = 1 To numPages

If I put a stop at the For Loop line, then back up to re-set the oRng and
re-get numPages, I get the correct numPages. How can I get correct numPages
without having to "back up"?

TIA
 
D

Doug Robbins - Word MVP

It maybe more reliable to use

BuiltInDocumentProperties(wdPropertyPages)

or

ActiveDocument.ComputeStatistics(wdStatisticPages)


--
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
 
Z

zSplash

Thanks, Doug. Great!

st.

Doug Robbins - Word MVP said:
It maybe more reliable to use

BuiltInDocumentProperties(wdPropertyPages)

or

ActiveDocument.ComputeStatistics(wdStatisticPages)


--
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
 

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