View Single Post
 
Old 12-03-2011, 01:33 AM
macropod's Avatar
macropod macropod is online now Windows 7 64bit Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,963
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

For a multi-word string as part of the Find array, you simply input that between the commas. For example:
StrFnd = "dog,cat,pig,this and that,horse,man"
If you need to find strings that include commas, you'd need to change the StrFind expression's separators and the Split expression's separators. For example:
StrFnd = "dog|cat|pig|this, that or something else|horse|man"
...
For i = 0 To UBound(Split(StrFnd, "|"))
...
.Text = Split(StrFnd, "|")(i)

As for finding two words that are near each other, you'd need to use a wildcard Find (ie .MatchWildcards = True) and, in the Find statement, an expression like:
"word1[?]{1,10}word2"
where 1 represents the minimum permitted number of intervening characters and 10 represents the maximum permitted number of intervening characters.

Do note that wildcard Find expressions are case-sensitive so, if a word might be in, say, title case, you'd need something like:
"[Ww]ord1 [?]{1,10} [Ww]ord2"
As for reversing the word order, that would require two Find operations.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote