View Single Post
 
Old 02-19-2019, 10:32 AM
MikeForward MikeForward is offline Windows 10 Office 2010
Novice
 
Join Date: Feb 2019
Posts: 10
MikeForward is on a distinguished road
Default Problems with wildcard search VBA

Hi there,

I am getting very odd results with the following wildcard search in VBA
Selection.Find.ClearFormatting
With Selection.Find
.Text = "[.,;:-\?\!^13^34]"
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindStop
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchAllWordForms = False
.MatchSoundsLike = False
.MatchWildcards = True
End With
Selection.Find.Execute

The intention was to find any of these characters:
. , ; : - ? ! [CR] and "

However, this search is also finding the "=" sign, even though its not in the list of search characters I have requested! Any ideas? I suspect I have encountered numerous similar instabilities in Selection.Find in Word. Does this function have documented issues?

As an aside, is it ok to put ^n1^n2^n3 ... in order to search for ascii characters n1, n2, n3 ...

Thanks

Mike
Reply With Quote