J
Jason L
Hey, I have another crazy wildcard search. I have a search that finds any
unformatted list beginning with a letter, then a period and then any text
until a paragraph mark. The macro then replaces the list with a formatted
list style called ListAlpha. These lists often range in length from a-g,
maybe longer. The macro was working fine, but lately the user has other
entries in the document that the wildcard search is finding, even though it
shouldn't. For example, it finds any middle name initial followed by a
period.
Here is the macro thus far:
With Selection.Find
.Text = " [ A-z].[^32^s^t]@"
.Replacement.Text = "1/^+"
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchAllWordForms = False
.MatchSoundsLike = False
.MatchWildcards = True
End With
Selection.Find.Execute Replace:=wdReplaceAll
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = "[ A-z].[^32^s^t]@"
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
.Format = True
.MatchCase = False
.MatchWholeWord = False
.MatchAllWordForms = False
.MatchSoundsLike = False
.MatchWildcards = True
End With
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
Selection.Find.Replacement.Style = ActiveDocument.Styles("ListAlpha")
TIA,
Jason
unformatted list beginning with a letter, then a period and then any text
until a paragraph mark. The macro then replaces the list with a formatted
list style called ListAlpha. These lists often range in length from a-g,
maybe longer. The macro was working fine, but lately the user has other
entries in the document that the wildcard search is finding, even though it
shouldn't. For example, it finds any middle name initial followed by a
period.
Here is the macro thus far:
With Selection.Find
.Text = " [ A-z].[^32^s^t]@"
.Replacement.Text = "1/^+"
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchAllWordForms = False
.MatchSoundsLike = False
.MatchWildcards = True
End With
Selection.Find.Execute Replace:=wdReplaceAll
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = "[ A-z].[^32^s^t]@"
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
.Format = True
.MatchCase = False
.MatchWholeWord = False
.MatchAllWordForms = False
.MatchSoundsLike = False
.MatchWildcards = True
End With
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
Selection.Find.Replacement.Style = ActiveDocument.Styles("ListAlpha")
TIA,
Jason