Originally Posted by
Fonsi
Hi there,
1. Any double dot at the end of a sentence should be replaced by a single dot.
2. Dot + space + dot at the end of a sentence should be replaced by a single dot.
3. word + double space + word should be replaced by replaced by a single space:
Single macro could do all that, but it's the 'end of a sentence' part that is a little tricky
End of a paragraph part is easy, but it is possible to have a Dot+space+Dot somewhere NOT at the end of sentence (maybe unlikely, but possible)
Maybe you could just assume a-z or 0-9 is the last character in the sentence
Sub Macro1()
With ActiveDocument.Content.Find
.ClearFormatting
.Replacement.ClearFormatting
.Text = "([a-z0-9]).{2,}"
.Replacement.Text = "\1."
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchAllWordForms = False
.MatchSoundsLike = False
.MatchWildcards = True
.Execute Replace:=wdReplaceAll
.Text = "([a-z0-9]). {1,}."
.Execute Replace:=wdReplaceAll
.Text = " {2,}"
.Replacement.Text = " "
.Execute Replace:=wdReplaceAll
End With
End Sub