Thank you so much macropod for this code, it is so close to perfect for me! I took out one line because it was starting the selection at the
beginning of the sentence that the insertion point is on, whereas I want the selection to start at where the insertion point currently is (even if it is in the middle of the sentence). So now it looks like this:
Code:
Sub Demo()
Dim strAbbr, i As Long
strAbbr = ".Mr.Mrs.etc."
With Selection
If .End < .Sentences.First.End Then .MoveEnd wdSentence, 1
While InStr(strAbbr, "." & Trim(.Words.Last.Previous.Words.First) & ".") > 0
.MoveEnd wdSentence, 1
Wend
End With
End Sub
There are only two problems with it now:
(1) First, and most importantly, if I run this macro while the insetion point is somewhere in the first sentence of a paragraph, so that the rest of the first sentence is selected, and then I run the macro a second time without doing anything else in between, the selection does not extend to the next (second) sentence in the paragraph. This is unlike the normal sentence-extend command (Selection.MoveRight Unit:=wdSentence, Count:=1, Extend:=wdExtend) which will extend the selection to the next sentence each time the command is run.
(2) Second, if I run this macro while the insetion point is in a ONE-sentence paragraph and the next line directly below this one-sentence paragraph has no text (i.e., it’s just a blank line with a Paragraph sign), the selection will extend down to also include the Paragraph sign of this second line. It would ideally stop after the first line and not select anything on the second line below. Strangely, the selection does stop immediately after the first sentence of a one-sentence paragraph if the very next line directly below does have some text.
If you could help me iron out these two issues, I would be infinitely grateful. I am even willing to pay someone to do this, it is that important to me to find an answer. I have tried understanding what needs to be changed, but it is over my head, as I couldn’t find documentation on the internet for some of the phrases your code uses.
And thank you gmaxey for your suggestion. I loaded that Add-in, but unfortunately it only selects entire sentences, and I can’t examine its coding. But I am very glad to see that I am not the only one who wants to do something like this!