View Single Post
 
Old 02-18-2014, 12:31 AM
macropod's Avatar
macropod macropod is offline Windows 7 32bit Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,363
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

The first thing you need to be aware of is that Word VBA's notion of what constitutes a sentence isn't what most readers would consider a sentence. For example, consider the following:

Mr. Smith spent $1,234.56 at Dr. John's Grocery Store, to buy: 10.25kg of potatoes; 10kg of avocados; and 15.1kg of Mrs. Green's Mt. Pleasant macadamia nuts.

For you and me, that would probably count as one sentence; for VBA it counts as 5... So what you're regarding as long sentences might not be the same as your macro's interpretation.

Given the above, I'd suggest a different approach, which is to use a two-dimensional array, with the 2nd dimension holding the 'sentence' index. Then, instead of using Find/Replace, simply retrieve the 'sentence' index when needed and highlight that 'sentence'. Just don't be surprised if some of the matches are only parts of grammatical sentences.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote