D
Designingsally
Sub Demo()
With Selection.Find
.ClearFormatting
.Replacement.ClearFormatting
.Text = "find"
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
.Execute
If .Found = True Then
MsgBox ("hi"), 45
.Replacement.Text = "fine"
.Execute Replace:=wdReplaceAll
End If
.Text = "many"
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
.Execute
If .Found = True Then
MsgBox ("hgh"), 45
.Replacement.Text = "uses"
.Execute Replace:=wdReplaceAll
End If
End With
End Sub
Hi
Take a look at the code above. Once the word find is found it is replaced as
fine. But only in the first instance the Message box is shown and the further
instances when the word FIND is found it is getting automatically replaced.
Which I dont want to happen. If a document has 10 finds, I want each find to
be highlighted and msgbox to be displayed at each case ie 10 times. I want
the macros to do it sequentially one by one. Can someone send me the code or
direct me how to do that?
And in the messgae box i want the 2 buttons ACCEPT and DECLINE. If the user
clicks ACCEPT the word must be autochanged. If the user clicks DECLINE I want
macros to be skipped to the next FIND in the document.
I m a novice in programming and macros. Pls help me thru this. Thanks a ton
in advance.
U can also contact me in (e-mail address removed)
With Selection.Find
.ClearFormatting
.Replacement.ClearFormatting
.Text = "find"
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
.Execute
If .Found = True Then
MsgBox ("hi"), 45
.Replacement.Text = "fine"
.Execute Replace:=wdReplaceAll
End If
.Text = "many"
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
.Execute
If .Found = True Then
MsgBox ("hgh"), 45
.Replacement.Text = "uses"
.Execute Replace:=wdReplaceAll
End If
End With
End Sub
Hi
Take a look at the code above. Once the word find is found it is replaced as
fine. But only in the first instance the Message box is shown and the further
instances when the word FIND is found it is getting automatically replaced.
Which I dont want to happen. If a document has 10 finds, I want each find to
be highlighted and msgbox to be displayed at each case ie 10 times. I want
the macros to do it sequentially one by one. Can someone send me the code or
direct me how to do that?
And in the messgae box i want the 2 buttons ACCEPT and DECLINE. If the user
clicks ACCEPT the word must be autochanged. If the user clicks DECLINE I want
macros to be skipped to the next FIND in the document.
I m a novice in programming and macros. Pls help me thru this. Thanks a ton
in advance.
U can also contact me in (e-mail address removed)