Home |
Search |
Today's Posts |
#1
![]() |
|||
|
|||
![]()
Is there any way to look for two different words and then stop if either is
found? i.e. something like... With Selection.Find .Text = "first" or "last" .Forward = True .Format = True .MatchCase = False .MatchWholeWord = False .MatchWildcards = True .MatchSoundsLike = False .MatchAllWordForms = False End With Selection.Find.Execute Thanks |
#2
![]() |
|||
|
|||
![]()
Are you searching through "Files and Folders" (C:\ Drive), Windows Explorer,
or Microsoft Office-Word, and what version? "JustLearning" wrote: Is there any way to look for two different words and then stop if either is found? i.e. something like... With Selection.Find .Text = "first" or "last" .Forward = True .Format = True .MatchCase = False .MatchWholeWord = False .MatchWildcards = True .MatchSoundsLike = False .MatchAllWordForms = False End With Selection.Find.Execute Thanks |
#3
![]() |
|||
|
|||
![]()
I am searching through words in an open document of Word 2003
"katin42" wrote: Are you searching through "Files and Folders" (C:\ Drive), Windows Explorer, or Microsoft Office-Word, and what version? "JustLearning" wrote: Is there any way to look for two different words and then stop if either is found? i.e. something like... With Selection.Find .Text = "first" or "last" .Forward = True .Format = True .MatchCase = False .MatchWholeWord = False .MatchWildcards = True .MatchSoundsLike = False .MatchAllWordForms = False End With Selection.Find.Execute Thanks |
#4
![]() |
|||
|
|||
![]()
On Thu, 23 Jun 2005 16:31:01 -0700, JustLearning
wrote: Is there any way to look for two different words and then stop if either is found? i.e. something like... With Selection.Find .Text = "first" or "last" .Forward = True .Format = True .MatchCase = False .MatchWholeWord = False .MatchWildcards = True .MatchSoundsLike = False .MatchAllWordForms = False End With Selection.Find.Execute Thanks There isn't any way to do exactly what you asked for. Depending on what you're looking for, though, you might be able to set up a wildcard search (see http://www.gmayor.com/replace_using_wildcards.htm) to find candidates. I realize that "first" and "last" are just examples, but -- taking them as an example -- you could use .Text = "[a-z]{2,3}st" That would find either of those words, but also "best" and "worst" and other matches. Then you'd need to replace the single .Execute with something like this to test whatever was found: Do While .Execute Select Case Selection.Text Case "first", "last" ' found it Exit Do Case Else ' do nothing End Select Loop If you have any more questions like this, I'd suggest posting them in microsoft.public.word.vba.beginners instead of here. -- Regards, Jay Freedman Microsoft Word MVP FAQ: http://word.mvps.org |
#5
![]() |
|||
|
|||
![]()
thanks!
"Jay Freedman" wrote: On Thu, 23 Jun 2005 16:31:01 -0700, JustLearning wrote: Is there any way to look for two different words and then stop if either is found? i.e. something like... With Selection.Find .Text = "first" or "last" .Forward = True .Format = True .MatchCase = False .MatchWholeWord = False .MatchWildcards = True .MatchSoundsLike = False .MatchAllWordForms = False End With Selection.Find.Execute Thanks There isn't any way to do exactly what you asked for. Depending on what you're looking for, though, you might be able to set up a wildcard search (see http://www.gmayor.com/replace_using_wildcards.htm) to find candidates. I realize that "first" and "last" are just examples, but -- taking them as an example -- you could use .Text = "[a-z]{2,3}st" That would find either of those words, but also "best" and "worst" and other matches. Then you'd need to replace the single .Execute with something like this to test whatever was found: Do While .Execute Select Case Selection.Text Case "first", "last" ' found it Exit Do Case Else ' do nothing End Select Loop If you have any more questions like this, I'd suggest posting them in microsoft.public.word.vba.beginners instead of here. -- Regards, Jay Freedman Microsoft Word MVP FAQ: http://word.mvps.org |
Reply |
Thread Tools | |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
How to stop formats to multiple words when one word is selected? | Microsoft Word Help | |||
Finding, cutting and pasting multiple words and paragraphs with ma | Microsoft Word Help | |||
I am looking for Word's TOC and TOA Generator, where will I find t | Microsoft Word Help | |||
Multiple docs open multiple words | New Users | |||
Recurring words/phrases | New Users |