C
Cecilkumara Fernando
Dear All,
Some time back with your help I developed the following macro which works
fine, The only drawback is that it has to be run separately, Can someone
tell me a way to bind it to a "keyup" event so as soon as a letter is typed
the necessary replacement is done.
Thank you,
Cecil
Option Base 1
Sub Replace()
vstr1 = Array("a", "s", "S")
vstr2 = Array("d", "e", "E", "q", "Q", "`", "Hd", "H", "%")
lstr1 = Array("A", "G", "K", "L", "O", "P", "T", "U", _
"c", "g", "j", "n", "o", "p", "r", "u", "v", ":", "|")
lstr2 = Array("o", "|")
rstr1 = Array(137, 184, 132, 209, 149, 135, 173, 158, _
129, 146, 174, 166, 188, 181, 169, 178, 161, 202, 222)
rstr2 = Array(191, 225)
For i = 1 To 3
For j = 1 To 19
fw = lstr1(j) & vstr1(i)
rw = rstr1(j) + i
With Selection.Find
.Text = fw
.Replacement.Text = Chr(rw)
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = True
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
Next j
Next i
For i = 1 To 9
For j = 1 To 2
fw = lstr2(j) & vstr2(i)
rw = rstr2(j) + i
With Selection.Find
.Text = fw
.Replacement.Text = Chr(rw)
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = True
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
Next j
Next i
With Selection.Find
.Text = ",q"
.Replacement.Text = Chr(213)
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = True
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = ",Q"
.Replacement.Text = Chr(214)
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = True
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
End Sub
Some time back with your help I developed the following macro which works
fine, The only drawback is that it has to be run separately, Can someone
tell me a way to bind it to a "keyup" event so as soon as a letter is typed
the necessary replacement is done.
Thank you,
Cecil
Option Base 1
Sub Replace()
vstr1 = Array("a", "s", "S")
vstr2 = Array("d", "e", "E", "q", "Q", "`", "Hd", "H", "%")
lstr1 = Array("A", "G", "K", "L", "O", "P", "T", "U", _
"c", "g", "j", "n", "o", "p", "r", "u", "v", ":", "|")
lstr2 = Array("o", "|")
rstr1 = Array(137, 184, 132, 209, 149, 135, 173, 158, _
129, 146, 174, 166, 188, 181, 169, 178, 161, 202, 222)
rstr2 = Array(191, 225)
For i = 1 To 3
For j = 1 To 19
fw = lstr1(j) & vstr1(i)
rw = rstr1(j) + i
With Selection.Find
.Text = fw
.Replacement.Text = Chr(rw)
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = True
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
Next j
Next i
For i = 1 To 9
For j = 1 To 2
fw = lstr2(j) & vstr2(i)
rw = rstr2(j) + i
With Selection.Find
.Text = fw
.Replacement.Text = Chr(rw)
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = True
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
Next j
Next i
With Selection.Find
.Text = ",q"
.Replacement.Text = Chr(213)
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = True
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = ",Q"
.Replacement.Text = Chr(214)
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = True
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
End Sub