I've run across a problem in Word 2003 that I didn't find addressed in the Word board or the MSKB (although it could be the words I used).
Suppose I want to find the number of occurrences of a word in a selection. The selection may be contiguous, empty (just the cursor at some position but nothing selected so implying the whole doc), or non-contiguous. Certainly in 2003, one can do non-contiguous selections. I think this was also in Word XP/2002, although I don't have that on any machines to test. If non-contiguous selections were in XP, I'd assume the results would be the same.
Use replace and set the Find What="desired word" and Replace With="desired word" or find-what-text - doesn't matter.
No problems with the 1st 2 cases (contiguous and empty) in terms of the count of replacements reported (the msg that says xx replacements were made).
But the 3rd case (non-contiguous) gives strange results.
I put together a simple document (see attached) of 9 paras of 5 sentences of "The quick brown fox..." using =rand. I chose "brown" as my subject word (maybe not a great choice-you'll see why). In the first 2 cases, 45 replacements of brown were reportedly made. Makes sense (9 paras x 5 sentences/para x 1 "brown"/sentence = let me see, don't tell me...[smilie for counting on fingers] 45!). In the 3rd case with 2 non-contiguous paras selected, 15 replacements were reportedly made!!!
Sinnse I ain't dat gude inn mass, I assoommed dat I kuldn't kount or it was a problem not having enough fingers and toes. <img src=/S/grin.gif border=0 alt=grin width=15 height=15> I asked Word to show me the 15 replacements by adding to the RW spec to change the color of the replacements to red. It still gave a report of 15 altho there were only 10 red brown's. When I let Word search the rest of the document, Word showed where it really shines: it reported 50 replacements made in the rest of the doc and 85 in total.
OK. Maybe this is the user interface. So I decided to try VBA. I recorded a macro (maybe a mistake). First 2 cases are fine. Then 3rd case: same 2 non-contiguous paras selected. Run the macro. Same report of 15 replacements but only 10 red brown's shown. I also let Word check the rest of the document. Here's where Word continued to show where it shined/shoned/shone: I got reports (on different runs of the macro) of 20, 55, and 75 for the brown's in the rest of the document.
Anyway, attached is my sample doc - play around and let me know if you get something that makes a little more sense.