![]() |
#1
|
|||
|
|||
![]()
Hi there,
I am finding odd results with the following wildcard search in Word 2010 VBA. I am trying to search for special codewords embedded in a Word doc which look like "ZXZABCDEF...". where X is a single character which can be 0-9,A-Z, as are the ABCDEF.... The first and third characters are always Z. The ABCDEF...is a minimum of 3 characters and a maximum of 16 characters. The following search works correctly in either backwards or forwards direction: [/code] Selection.Find.ClearFormatting With Selection.Find .Text = "<Z[0-9A-Z]Z[0-9A-Z]{3}" .Replacement.Text = "" .Forward = bForwards '***where bForwards is a Boolean = true or false .Wrap = wdFindStop .Format = False .MatchCase = False .MatchWholeWord = False .MatchAllWordForms = False .MatchSoundsLike = False .MatchWildcards = True End With b = Selection.Find.Execute[/code] However, if I change the {3} in the .Text= line to {3,16} the search then works forwards, but fails backwards! Any ideas? Macropod - this is a simplified form of my first question, and does seem to give genuinely odd results. I promise no more questions for a while after this! Thanks a lot Mike |
Tags |
wildcard searches |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
![]() |
Cosmo | Word VBA | 9 | 02-12-2016 08:03 PM |
Change characters outside a wildcard while keeping wildcard results | nymusicman | Word VBA | 2 | 04-10-2014 08:17 AM |
2013 search results take a long time - they fill in as results in reverse date order | themookman | Outlook | 0 | 10-11-2013 12:01 PM |
![]() |
swami | Word | 2 | 09-04-2013 11:34 PM |
Wildcard search help. | Kempston | Word | 0 | 11-13-2009 03:58 AM |