How do I get page count from a Word document object?

M

MDB

I have a VB.NET application that manages .PRN documents created from Word
documents. I want to expand the app to include the ability to transition the
..DOCs into .PRN, one .PRN for every page in the .DOC. Everything works just
the way it should now, as long as I know how many pages are in the .DOC up
front. But the ideal situation would be if I can get the number of pages from
the just-opened Word document object. Short of going back to define a
NUMPAGES field on hundreds of .DOCs, how can I get the Word document object
to give up that information at that time it's opened?
 
S

Shauna Kelly

Hi MDB

In VBA-speak that would be
ActiveDocument.Content.Information(wdActiveEndPageNumber)

There's more information about the Information property in Word's VBA help.

Hope this helps.

Shauna Kelly. Microsoft MVP.
http://www.shaunakelly.com/word
 
M

MDB

The company, in its infinite wisdom, didn't install VBA help with the Office
image because no one anticipated we'd be doing anything other than creating
and reading documents with it. Thank goodness for online help.

This fixed things nicely, thank you!! Never thought to look under the
Content object, let alone Information. Not exactly intuitive for those of us
who are primarily ASP.NET developers and doing VBA by the seat of our pants.
<g>
 

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