Re: Possible Word 2003 bug

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



G'day Garrett Manahan <GarrettManahan@xxxxxxxxxxxxxxxxxxxxxxxxx>,

Some suggestions in the order I would try:

Use the collapsed range of the last cell's content as your test range
(different from the range for the end of the table)

Force a document repagination first

Only use .info etc off a selection object


Steve Hudson - Word Heretic

steve from wordheretic.com (Email replies require payment)
Without prejudice


Garrett Manahan reckoned:

>I am Running into a problem in Word 2003 where certain internal properties in
>Word don't seem to be updating properly. Specifically, this problem is
>occuring when I programmatically insert a table or paragraph into a Word
>document and it happens to cause a soft page break. I use the ".information"
>method to determine if the the ending page number is different then before
>the range was inserted. In some cases, Word does not return the correct
>result. In some instances I have tried using the document range object and
>the ".computestatistics(wdstatisticpages)" method to determine if a new page
>has been added. That seemed to work, until now. I have just run into
>another instance where neither the ".information" method on the inserted
>range, nor the ".computestatistics" method on the document range report the
>new page as being there. But, if I use the ".computestatistics" method off
>of just the document object, it seems to report correctly. Sorry that was
>long winded, but here is an example.
>
> using vb, I programmatically insert a table from file into the Word
>document starting on the last page which is currently 9. The inserted table
>causes as soft page in the Word document. Using the following methods
>produces different results. The correct result should be 10.
>
> myRange.information(wdactivepagenumber) = 9
> mydocument.range.information(wdactivepagenumber) = 9
> mydocument.range.computestatistics(wdstatisticpages) = 9
> mydocument.computestatistics(wdstatisticpages) = 10
>
>Again, sometimes the mydocument.range.computestatistics(wdstatisticpages)
>returns correctly, but sometimes it doesn't. I have tried repaginating the
>document but that doesn't help. The only thing that does seem to work is to
>save the document. While saving generally isn't a problem, it doesn't seem
>like that should be necessary. Anybody else run into this problem?
>
>Garrett

.