Try the following update - it should be much faster than the pervious versions. The reasons for that are twofold:
1. The Find expressions only find words that both begin with an accented character (or character pair in the case of εύ) and contain at least one more accented character, instead of just every word that starts with an accented character; and
2. The Execute expression uses ReplaceAll instead of having to process each found word individually.
The reason for there being four Find expressions character/pair is to cater for words that may (a) have an accented 2nd character; (b) have an accented 3rd or later character; and (c) words beginning with both lower & upper case. I haven't bothered with words that are entirely upper case, but I expect you can see from the code how that might be handled.
Sub Demo()
Application.ScreenUpdating = False
Dim ArrChr, StrStr As String, i As Long
Dim StrFnd1 As String, StrFnd2 As String
ArrChr = Array( _
ChrW(&H3AC), ChrW(&H3B1), ChrW(&H3AD), ChrW(&H3B5), ChrW(&H3AE), _
ChrW(&H3B7), ChrW(&H390), ChrW(&H3B9), ChrW(&H3CA), ChrW(&H3B9), _
ChrW(&H3AF), ChrW(&H3B9), ChrW(&H3CC), ChrW(&H3BF), ChrW(&H3CD), _
ChrW(&H3C5), ChrW(&H3B0), ChrW(&H3C5), ChrW(&H3CE), ChrW(&H3C9))
For i = 0 To UBound(ArrChr) Step 2
StrStr = StrStr & ArrChr(i)
Next
StrFnd1 = "([" & StrStr & "])"
StrFnd2 = "([" & ChrW(&H3B1) & "-" & ChrW(&H3C9) & "]@[" & StrStr & "])"
With ActiveDocument.Range.Find
.ClearFormatting
.Replacement.ClearFormatting
.Forward = True
.Wrap = wdFindContinue
.MatchWildcards = True
For i = 0 To UBound(ArrChr) Step 2
.Replacement.Text = ArrChr(i + 1) & "\1"
.Text = "<" & ArrChr(i) & StrFnd1
.Execute Replace:=wdReplaceAll
.Text = "<" & ArrChr(i) & StrFnd2
.Execute Replace:=wdReplaceAll
.Replacement.Text = UCase(ArrChr(i + 1)) & "\1"
.Text = "<" & UCase(ArrChr(i)) & StrFnd1
.Execute Replace:=wdReplaceAll
.Text = "<" & UCase(ArrChr(i)) & StrFnd2
.Execute Replace:=wdReplaceAll
Next
.Replacement.Text = "\1" & ChrW(&H3C5) & "\2"
.Text = "<(" & ChrW(&H3B5) & ")" & ChrW(&H3CD) & StrFnd1
.Execute Replace:=wdReplaceAll
.Text = "<(" & ChrW(&H3B5) & ")" & ChrW(&H3CD) & StrFnd2
.Execute Replace:=wdReplaceAll
.Text = "<(" & ChrW(&H3B5) & ")" & UCase(ChrW(&H3B5)) & StrFnd1
.Execute Replace:=wdReplaceAll
.Text = "<(" & ChrW(&H3B5) & ")" & UCase(ChrW(&H3B5)) & StrFnd2
.Execute Replace:=wdReplaceAll
End With
Application.ScreenUpdating = True
End Sub
Bookmarks