Hi Greg,
you don't even need a "select case" command.
Sub Resetsearch()
With Selection.Find
.ClearFormatting
.Replacement.ClearFormatting
.Text = ""
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
.Execute
End With
End Sub
Sub Test444()
Resetsearch
Dim sMsg1 As String ' String Message 1
Dim sRslt As String ' String Result of Inputbox
sMsg1 = "Type in any additional leading character"
With ActiveDocument.Range.Find
.MatchWildcards = True
.Text = "< {1,}*"
.Replacement.Text = ""
.Execute Replace:=wdReplaceAll
.Text = "(^13)( {1,}*)"
.Replacement.Text = "\1"
.Execute Replace:=wdReplaceAll
.Text = "(^l)( {1,}*)"
.Replacement.Text = "\1"
.Execute Replace:=wdReplaceAll
.Text = "( {1,})(^13)"
.Replacement.Text = "\2"
.Execute Replace:=wdReplaceAll
.Text = "( {1,})(^l)"
.Replacement.Text = "\2"
.Execute Replace:=wdReplaceAll
sRslt = InputBox(sMsg1)
.MatchWildcards = False
.Text = sRslt
.Replacement.Text = ""
.Execute Replace:=wdReplaceAll
End With
Resetsearch
End Sub
---
If you feel like diving into this really deeply,
and find the hard coded repetitions not too convincing,
then you need a loop indeed!
Let's say there were hundreds of replacing operations.
Then I would put the search string, the replacement string
and a representative for the boolean "matchwildcards"
in an extra file, like this:
( {1,})(^13)
\1
0 ' ???
I would count the lines in the file,
dimension an array accordingly,
read the lines of file into the array,
and work my way through something (!) like this,
untested, of course.
For i = 1 to upperbound(Myarray)
.Text = Myarray(1)
.Replacement.Text = Myarray(2)
.MatchWildcards = Cbool(Myarray(3))
.Execute Replace:=wdReplaceAll
next