MaryAnn1985
Technical User
I am writing a Microsoft Word macro and I want the macro to search the whole file for specific word endings and to write something in front of the words that have these specific endings. I used a loop, because the macro has to search the whole file for these endings, but it has to search the file only once (not over and over again), so I want the macro to stop at the bottom of the file. How can I do this? Thanks in advance!
This is an early version of the macro (including only one ending, namely -aisia ) :
Do
Selection.Find.ClearFormatting
With Selection.Find
.Text = "aisia "
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindStop
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
If Not Selection.Find.Found Then Exit Do
Selection.MoveLeft Unit:=wdWord, Count:=1
Selection.TypeText Text:="<partitive>"
Loop Until Not Selection.Find.Found
End Sub
This is an early version of the macro (including only one ending, namely -aisia ) :
Do
Selection.Find.ClearFormatting
With Selection.Find
.Text = "aisia "
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindStop
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
If Not Selection.Find.Found Then Exit Do
Selection.MoveLeft Unit:=wdWord, Count:=1
Selection.TypeText Text:="<partitive>"
Loop Until Not Selection.Find.Found
End Sub