View Single Post
 
Old 09-20-2022, 03:14 PM
macropod's Avatar
macropod macropod is offline Windows 10 Office 2016
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,465
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

I doubt VBA would be much help with this, since VBA has no idea what a grammatical sentence is. For example, consider the following:
Quote:
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 count as one sentence; for VBA it counts as 5 sentences.

You can achieve most of what you want with a wildcard Find/Replace, where:
Find = ([!.\!\?;:]@[.\!\?;:])([ ^13])
Replace = \1/\1\2

Regarding tables, you might need to ensure the final sentence has the appropriate punctuation and there's at least a space character before the end-of-cell marker. Textbox final sentences would also require the appropriate punctuation.

With lists, the 'and' or 'or' following the penultimate entry won't be duplicated, nor will final entries followed by a comma.

Sentences containing decimal numbers will also trip up the Find/Replace, with only the portion following the decimal being duplicated.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote