View Single Post
 
Old 11-01-2018, 01:41 PM
kvnrao kvnrao is offline Windows 10 Office 2016
Novice
 
Join Date: Nov 2018
Posts: 4
kvnrao is on a distinguished road
Default multiple find and replace in vba for special words

I have the following vba macro in msoffice word, where individual programs are written for each special word. How to write a combined and comprehensive program.
Sub Macro1()
'
' Macro1 Macro
'
'
Selection.HomeKey

With Selection.Find
.Text = ChrW(257)
.Replacement.Text = "A"
.Forward = True
.Wrap = wdFindContinue
End With
Selection.Find.Execute Replace:=wdReplaceAll

' Selection.HomeKey
With Selection.Find
.Text = ChrW(275)
.Replacement.Text = "E"
.Forward = True
.Wrap = wdFindContinue
End With
Selection.Find.Execute Replace:=wdReplaceAll

With Selection.Find
.Text = ChrW(299)
.Replacement.Text = "I"
.Forward = True
.Wrap = wdFindContinue
End With
Selection.Find.Execute Replace:=wdReplaceAll

With Selection.Find
.Text = ChrW(333)
.Replacement.Text = "O"
.Forward = True
.Wrap = wdFindContinue
End With
Selection.Find.Execute Replace:=wdReplaceAll
With Selection.Find
.Text = ChrW(363)
.Replacement.Text = "U"
.Forward = True
.Wrap = wdFindContinue
End With
Selection.Find.Execute Replace:=wdReplaceAll

End Sub
Reply With Quote