D
Designingsally
Hi sorry for posting a blank post. i pressed POST without my knowledge.
I was wondering if macros can do go one step back at the middle of a
process. for example. I got this sample data like
I love you. I love this world. I love this country. I love myself.
I got this find and replace macro which ll replace love to hate. when i m in
the third hate in the given sentence i realise that i want to undo the
previous process. In other words go back to second love in the sentence. And
after doing appropriate changes the macros ll move on to the third love is
that possible? I kmow i need to set some counter which ll enable to move
back. Can someone tell me how to do that?
Probably when the user clicks cancel button the macro ll go to the previous
process
I ll be glad if some help comes along. Thanks in advance for ur support
The macro I got is
Dim orng As Range
Dim sRep As String
Dim sFindText As String
Dim sRepText As String
sFindText = "love" 'the word to find
sRepText = "hate" 'the word to replace
With Selection
..HomeKey wdStory
With .FInd
..ClearFormatting
..Replacement.ClearFormatting
..Wrap = wdFindContinue
..Format = False
..MatchCase = False
..MatchWholeWord = True
..MatchWildcards = False
..MatchSoundsLike = False
..MatchAllWordForms = False
While .Execute(findText:=sFindText)
Set orng = Selection.Range
sRep = Msgbox("The Recommended Word is and so on. Replace?", vbYesNoCancel)
If sRep = vbCancel Then
** I know that i need to add that coutner here** correct me if i m wrong.
Exit Sub
End If
If sRep = vbYes Then
orng.Text = sRepText
End If
Wend
I was wondering if macros can do go one step back at the middle of a
process. for example. I got this sample data like
I love you. I love this world. I love this country. I love myself.
I got this find and replace macro which ll replace love to hate. when i m in
the third hate in the given sentence i realise that i want to undo the
previous process. In other words go back to second love in the sentence. And
after doing appropriate changes the macros ll move on to the third love is
that possible? I kmow i need to set some counter which ll enable to move
back. Can someone tell me how to do that?
Probably when the user clicks cancel button the macro ll go to the previous
process
I ll be glad if some help comes along. Thanks in advance for ur support
The macro I got is
Dim orng As Range
Dim sRep As String
Dim sFindText As String
Dim sRepText As String
sFindText = "love" 'the word to find
sRepText = "hate" 'the word to replace
With Selection
..HomeKey wdStory
With .FInd
..ClearFormatting
..Replacement.ClearFormatting
..Wrap = wdFindContinue
..Format = False
..MatchCase = False
..MatchWholeWord = True
..MatchWildcards = False
..MatchSoundsLike = False
..MatchAllWordForms = False
While .Execute(findText:=sFindText)
Set orng = Selection.Range
sRep = Msgbox("The Recommended Word is and so on. Replace?", vbYesNoCancel)
If sRep = vbCancel Then
** I know that i need to add that coutner here** correct me if i m wrong.
Exit Sub
End If
If sRep = vbYes Then
orng.Text = sRepText
End If
Wend