Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
![]()
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 | |
|
|
![]() |
||||
Thread | Forum | |||
how do i search for exact words in multiple documents | Microsoft Word Help | |||
How to search for duplicate words in the same document | Microsoft Word Help | |||
Search for multiple words in document | Microsoft Word Help | |||
How do i search for multiple words in a word document? | Microsoft Word Help | |||
Can I search for words in multiple Word documents using OR? | Microsoft Word Help |