Hi guys,
First, I would like to tell you that this example is not for English but for Arabic
This code I want to do the following:
- Search once at each hotkey press
- If the word is finished with a letter M delete the letter and write instead letter N.
- If the word ends with a letter N, delete the letter and write instead a letter M.
I do not know well using the IF - Then statement
Please help me
Sub findend() Selection.Find.ClearFormatting Selection.Find.Replacement.ClearFormatting With Selection.Find .Text = "[nm]>" .Replacement.Text = "" .Forward = True .Wrap = wdFindContinue .MatchWildcards = True Selection.Find.Execute With Selection If Selection.Find.Found = n Then Selection.TypeText Text:=m Else If Selection.Find.Found = m Then Selection.TypeText Text:=n End If End Sub
Any help would be greatly appreciated.