dsofile.dll returns incorrect page count

M

Mark Cykowski

I have some VBA code that uses dsofile.dll to retrieve
Word document properties without opening the documents.
It works great most of the time except sometimes it
returns a page count of 2 when the document actually has
3 pages. Has anyone else experienced this problem?
 
J

Jonathan West

Mark Cykowski said:
I have some VBA code that uses dsofile.dll to retrieve
Word document properties without opening the documents.
It works great most of the time except sometimes it
returns a page count of 2 when the document actually has
3 pages. Has anyone else experienced this problem?

Hi Mark,

Yes, this is a common problem, caused by the fact that Word does not always
update the page count when the document is saved. dsofile is correctly
reading the property stored in the document, but the property is being set
incorrectly by Word.

To ensure that the property is always set correctly, you need to use the
following line of code just before saving the document

ActiveDocument.ComputeStatistics wdStatisticPages

--
Regards
Jonathan West - Word MVP
MultiLinker - Automated generation of hyperlinks in Word
Conversion to PDF & HTML
http://www.multilinker.com
 

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