Posts Tagged “Word 2010”

As more people migrate away from Word 2003 and 2007 to a newer version, more bugs are starting to come out of the woodwork. Again, this one was brought up in a forum.

When a developer writes code to use Word’s built-in Find functionality, it’s usually to do a “Replace all”, or to run a loop that stops after every “hit” until the entire search Range has been processed. It’s therefore common practice to pass wdFindStop to the Wrap property (or argument of the Execute method).

It’s only rarely that we see code using wdFindAsk, so perhaps it’s not surprising that the bug hadn’t been reported previously by earlier adapters of Word 2010…

In the problem scenario, Find should only run on the current selection, then ask the user whether it should continue to execute across the entire document. This is quite legitimate and imitates the user interface. What’s happening is that Find does not stop after checking the current selection, but continues to run for the entire document (does the same as wdFindContinue).

Interestingly enough, wdFindAsk does work correctly when the end of the document is reached, asking the user if the search should continue from the beginning of the document.

Following is some VBA code that works around the problem, so that the user is queried both at the end of the selection and at the end of the document. Read the rest of this entry »

Comments No Comments »

A person in the Word for Developers forum brought an important bug to our attention last week. When documents are opened/created then closed the Documents collection does not keep proper track. The index value is not reduced correctly (there are more documents in the collection than there should be) and some document names are missing while others are duplicated. (The thread with repro code sample can be found here.) Read the rest of this entry »

Comments 10 Comments »