Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > microsoft.public.excel.programming > #109435

Re: Search Word document based on text in Excel cell.

From isabelle <i@v.invalid>
Newsgroups microsoft.public.excel.programming
Subject Re: Search Word document based on text in Excel cell.
Date 2016-10-19 19:44 -0400
Organization Aioe.org NNTP Server
Message-ID <nu90g6$8b7$1@gioia.aioe.org> (permalink)
References <a12c711d-c8e3-488e-b2bf-a57fa99a0889@googlegroups.com> <nu8vaq$73p$2@gioia.aioe.org> <nu8vqj$7l9$1@gioia.aioe.org>

Show all headers | View raw


...it would be better to specify "a part of the cell"
replace
Set c = .Find(keywords, LookIn:=xlValues)
by
Set c = .Find(keywords, LookIn:=xlValues, LookAt:=xlPart)

isabelle

Le 2016-10-19 à 19:32, isabelle a écrit :
> oops sory,
> replace
> n = Application.Find("green", c)
> by
> n = Application.Find(keywords, c)
>
> isabelle
>
> Le 2016-10-19 à 19:24, isabelle a écrit :
>> Hi Ronald,
>>
>> Here's an example:
>>
>> Sub Macro1()
>> Dim keywords As String, c As Range, n As Integer
>> keywords = "green" ' adapt
>> With Worksheets(1).Range("a1:a500")
>>     Set c = .Find(keywords, LookIn:=xlValues)
>>     If Not c Is Nothing Then
>>         firstAddress = c.Address
>>
>>         Do
>>             n = Application.Find("green", c)
>>             With c.Characters(Start:=n, Length:=Len(keywords))
>>               .Font.Color = RGB(255, 0, 0)
>>             End With
>>
>>             Set c = .FindNext(c)
>>         Loop While Not c Is Nothing And c.Address <> firstAddress
>>
>>     End If
>> End With
>> End Sub
>>
>> isabelle
>>
>> Le 2016-10-19 à 15:51, Ronald a écrit :
>>> Hello all,
>>>
>>> I have this recurrent task where I need to search trough a document for a
>>> bunch of keywords and highlight them somehouw, preferred with a different
>>> color. Of course I can do an Cntl-F enter text and search for it but the
>>> keywords are too much.
>>>
>>> Let me explain it on a easy way,
>>>
>>> Excel: A list of cells (in one column) with keywords, say: green dog, big
>>> cat, small bird, green tree etc.
>>>
>>> Word: A portion of text where the spoken keywords may appear randomly.
>>>
>>> Desired: If a keyword (actually sentence because it can have multiple words)
>>> is found in the Word text it should be highlighted (preferrable a different
>>> color for keyword). Would be superduper if a cell in Excel near to the
>>> keyword would display if the keyword was found or not.
>>>
>>> Just wanted to know if some of you experts saw somewhere a solution for this
>>> and can tell me where to fing it. Any help would be grateful!
>>>
>>> Cheers,
>>>
>>> Fred.
>>>

Back to microsoft.public.excel.programming | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Search Word document based on text in Excel cell. Ronald <rmoleveld@gmail.com> - 2016-10-19 12:51 -0700
  Re: Search Word document based on text in Excel cell. isabelle <i@v.invalid> - 2016-10-19 19:24 -0400
    Re: Search Word document based on text in Excel cell. isabelle <i@v.invalid> - 2016-10-19 19:32 -0400
      Re: Search Word document based on text in Excel cell. isabelle <i@v.invalid> - 2016-10-19 19:44 -0400
        Re: Search Word document based on text in Excel cell. Ronald <rmoleveld@gmail.com> - 2016-10-20 02:42 -0700
  Re: Search Word document based on text in Excel cell. Claus Busch <claus_busch@t-online.de> - 2016-10-20 03:30 +0200
  Re: Search Word document based on text in Excel cell. Ronald <rmoleveld@gmail.com> - 2016-10-20 02:39 -0700
    Re: Search Word document based on text in Excel cell. Claus Busch <claus_busch@t-online.de> - 2016-10-20 12:09 +0200
      Re: Search Word document based on text in Excel cell. Ronald <rmoleveld@gmail.com> - 2016-10-20 04:26 -0700
        Re: Search Word document based on text in Excel cell. Claus Busch <claus_busch@t-online.de> - 2016-10-20 13:39 +0200
          Re: Search Word document based on text in Excel cell. Ronald <rmoleveld@gmail.com> - 2016-10-20 04:57 -0700
            Re: Search Word document based on text in Excel cell. Claus Busch <claus_busch@t-online.de> - 2016-10-20 14:03 +0200
              Re: Search Word document based on text in Excel cell. Ronald <rmoleveld@gmail.com> - 2016-10-20 11:17 -0700
                Re: Search Word document based on text in Excel cell. Claus Busch <claus_busch@t-online.de> - 2016-10-21 08:02 +0200
                Re: Search Word document based on text in Excel cell. Ronald <rmoleveld@gmail.com> - 2016-10-21 04:04 -0700
                Re: Search Word document based on text in Excel cell. Ronald <rmoleveld@gmail.com> - 2016-10-24 07:21 -0700
                Re: Search Word document based on text in Excel cell. Ronald <rmoleveld@gmail.com> - 2016-10-24 07:30 -0700
                Re: Search Word document based on text in Excel cell. Claus Busch <claus_busch@t-online.de> - 2016-10-25 13:21 +0200

csiph-web