R
Roy
Hi
I managed to record & edit the two simple macros showing below.
Sub Macro1()
'
' Macro1 Macro
' Macro created 9/7/2008 by me
'
Selection.Find.ClearFormatting
With Selection.Find
.Text = "[a-h]{3,}"
.Forward = True
.Wrap = wdFindContinue
.MatchWildcards = True
End With
Selection.Find.Execute
Selection.Find.ClearFormatting
With Selection.Find
.Text = ""
.MatchWildcards = False
End With
Selection.Find.Execute
End Sub
Sub Macro2()
'
' Macro2 Macro
' Macro recorded 9/7/2008 by me
'
Selection.Find.ClearFormatting
With Selection.Find
.Text = "[a-fh][a-h]"
.Forward = True
.Wrap = wdFindContinue
.MatchWildcards = True
End With
Selection.Find.Execute
Selection.Find.ClearFormatting
With Selection.Find
.Text = "g[gh]"
.Forward = True
.Wrap = wdFindContinue
.MatchWildcards = True
End With
Selection.Find.Execute
Selection.Find.ClearFormatting
With Selection.Find
.Text = ""
.MatchWildcards = False
End With
Selection.Find.Execute
End Sub
Their job is to find an erroneous sequence of letters (represented here with
the letters a to h). After creating toolbar buttons for each of them, they
should be used in the following manner. The user clicks on Macro1 button; if
text is found, he should correct it manually (the correction should be
composed of 2 letters only). He keeps clicking on Macro1 button and making
corrections till no more results are found. After that, he moves to Macro2
button and does the same thing, making any needed corrections manually. Now
my question is, Is it possible to make Macro2 automatically start running
when Macro1 finds no more results, maybe by merging the 2 macros into one or
anything else?
PS: I had to add the '...Text = "" MatchWildcards = False ...' part
to each macro because it's the only way I found to automatically uncheck Use
Wildcards. The user is supposed to make normal, non-wildcard searches after
using the macros. So the part was added only to avoid confusing him.
Thanks in advance for your help.
I managed to record & edit the two simple macros showing below.
Sub Macro1()
'
' Macro1 Macro
' Macro created 9/7/2008 by me
'
Selection.Find.ClearFormatting
With Selection.Find
.Text = "[a-h]{3,}"
.Forward = True
.Wrap = wdFindContinue
.MatchWildcards = True
End With
Selection.Find.Execute
Selection.Find.ClearFormatting
With Selection.Find
.Text = ""
.MatchWildcards = False
End With
Selection.Find.Execute
End Sub
Sub Macro2()
'
' Macro2 Macro
' Macro recorded 9/7/2008 by me
'
Selection.Find.ClearFormatting
With Selection.Find
.Text = "[a-fh][a-h]"
.Forward = True
.Wrap = wdFindContinue
.MatchWildcards = True
End With
Selection.Find.Execute
Selection.Find.ClearFormatting
With Selection.Find
.Text = "g[gh]"
.Forward = True
.Wrap = wdFindContinue
.MatchWildcards = True
End With
Selection.Find.Execute
Selection.Find.ClearFormatting
With Selection.Find
.Text = ""
.MatchWildcards = False
End With
Selection.Find.Execute
End Sub
Their job is to find an erroneous sequence of letters (represented here with
the letters a to h). After creating toolbar buttons for each of them, they
should be used in the following manner. The user clicks on Macro1 button; if
text is found, he should correct it manually (the correction should be
composed of 2 letters only). He keeps clicking on Macro1 button and making
corrections till no more results are found. After that, he moves to Macro2
button and does the same thing, making any needed corrections manually. Now
my question is, Is it possible to make Macro2 automatically start running
when Macro1 finds no more results, maybe by merging the 2 macros into one or
anything else?
PS: I had to add the '...Text = "" MatchWildcards = False ...' part
to each macro because it's the only way I found to automatically uncheck Use
Wildcards. The user is supposed to make normal, non-wildcard searches after
using the macros. So the part was added only to avoid confusing him.
Thanks in advance for your help.