A Microsoft Word forum. Microsoft Office Word Forum - WordBanter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » Microsoft Office Word Forum - WordBanter forum » Microsoft Word Newsgroups » Microsoft Word Help
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

Find multiple words



 
 
Thread Tools Display Modes
  #1  
Old June 24th 05, 12:31 AM
JustLearning
external usenet poster
 
Posts: n/a
Default Find multiple words

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
Ads
  #2  
Old June 24th 05, 12:59 AM
katin42
external usenet poster
 
Posts: n/a
Default

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  
Old June 24th 05, 01:04 AM
JustLearning
external usenet poster
 
Posts: n/a
Default

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  
Old June 24th 05, 04:31 AM
Jay Freedman
external usenet poster
 
Posts: n/a
Default

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  
Old June 24th 05, 03:27 PM
JustLearning
external usenet poster
 
Posts: n/a
Default

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

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to stop formats to multiple words when one word is selected? Paul Freeman Microsoft Word Help 1 May 18th 05 06:39 PM
Finding, cutting and pasting multiple words and paragraphs with ma Nexan Microsoft Word Help 6 March 2nd 05 06:49 PM
I am looking for Word's TOC and TOA Generator, where will I find t Cocostar Microsoft Word Help 1 January 12th 05 11:15 PM
Multiple docs open multiple words Ron Smith New Users 2 December 11th 04 10:21 PM
Recurring words/phrases Pegge New Users 1 December 9th 04 03:08 AM


All times are GMT +1. The time now is 01:59 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.
Copyright 2004-2018 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.