Reply
 
Thread Tools Display Modes
  #1   Report Post  
Posted to microsoft.public.word.docmanagement
tj7 tj7 is offline
external usenet poster
 
Posts: 2
Default Word 2007 Search for multiple words in 1 document

Is there anyway to search for multiple words in Word even if only 1 of them
is present?

i.e. search for Dog or cat or pig or horse.
  #2   Report Post  
Posted to microsoft.public.word.docmanagement
Graham Mayor Graham Mayor is offline
external usenet poster
 
Posts: 19,312
Default Word 2007 Search for multiple words in 1 document

You can do so in an open document with a macro. What would you want to do
with the words having found them?

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org



tj7 wrote:
Is there anyway to search for multiple words in Word even if only 1
of them is present?

i.e. search for Dog or cat or pig or horse.



  #3   Report Post  
Posted to microsoft.public.word.docmanagement
tj7 tj7 is offline
external usenet poster
 
Posts: 2
Default Word 2007 Search for multiple words in 1 document

I would just want them highlighted in some manner. Basically searching for a
few needles in a large haystack and they may or may not be there.
Thanks
TJ

"Graham Mayor" wrote:

You can do so in an open document with a macro. What would you want to do
with the words having found them?

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org



tj7 wrote:
Is there anyway to search for multiple words in Word even if only 1
of them is present?

i.e. search for Dog or cat or pig or horse.




  #4   Report Post  
Posted to microsoft.public.word.docmanagement
Graham Mayor Graham Mayor is offline
external usenet poster
 
Posts: 19,312
Default Word 2007 Search for multiple words in 1 document

If by 'highlighting' you mean 'selecting' then it is only possible to do so
one at a time.

Sub FindWords()
Dim vFindText
Dim r As Range
Dim i As Long
vFindText = Array("dog", "cat", "pig", "horse")
For i = 0 To UBound(vFindText)
Set r = ActiveDocument.Range
With r.Find
.Text = vFindText(i)
Do While .Execute(Forward:=True) = True
r.Select
MsgBox r
Loop
End With
Next
End Sub

If however you mean highlighting as in adding a coloured background, then
that is easy enough to achieve using a macro

Sub HiLightList()
Dim vFindText
Dim r As Range
Dim i As Long
vFindText = Array("dog", "cat", "pig", "horse")
For i = 0 To UBound(vFindText)
Set r = ActiveDocument.Range
With r.Find
.Text = vFindText(i)
Do While .Execute(Forward:=True) = True
r.HighlightColorIndex = wdYellow
Loop
End With
Next
End Sub

http://www.gmayor.com/installing_macro.htm

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org




tj7 wrote:
I would just want them highlighted in some manner. Basically
searching for a few needles in a large haystack and they may or may
not be there.
Thanks
TJ

"Graham Mayor" wrote:

You can do so in an open document with a macro. What would you want
to do with the words having found them?

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org



tj7 wrote:
Is there anyway to search for multiple words in Word even if only 1
of them is present?

i.e. search for Dog or cat or pig or horse.



Reply
Thread Tools
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
how do i search for exact words in multiple documents Summertime Microsoft Word Help 1 February 5th 09 10:08 PM
How to search for duplicate words in the same document SAM049 Microsoft Word Help 6 November 9th 08 02:36 AM
Search for multiple words in document RuneScape_Slayer85 Microsoft Word Help 2 March 20th 07 05:17 PM
How do i search for multiple words in a word document? ewar2002 Microsoft Word Help 1 January 22nd 07 01:28 PM
Can I search for words in multiple Word documents using OR? Lynn Microsoft Word Help 4 April 5th 06 05:00 PM


All times are GMT +1. The time now is 01:51 PM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"