+ Reply to Thread
Results 1 to 2 of 2

Marco; extract to Word and highlight constant search terms?

  1. #1
    Registered User
    Join Date
    10-11-2016
    Location
    Los Angeles, CA
    MS-Off Ver
    Pro plus 2010 (32-bit)
    Posts
    1

    Marco; extract to Word and highlight constant search terms?

    I am wondering if this is possible.

    First I have an Excel Workbook with 3 sheets. Sheet1 that is loaded with data. Each ROW is an independent set and the columns list different pieces of date for each set. Example…

    Jeff | [email protected] | phone number | abstract | more data

    I run a macro that looks at Sheet3 for keywords. The macro then searches column P in Sheet1 for those keywords. When the macro finds a keyword in column P, the macro copies the whole row and pastes the row in Sheet2. End Macro.

    The data in each cell of column P is an enormous (~ 1000 words) abstract. Instead of reading the whole abstract, I can glean the required info by reading a few words around/near a constant set of 3 words. Example…

    Constant set of words: red, fox

    Yesterday I saw a fox jump over the fence. The fox was a very odd shade of red.

    Is it possible to create a macro that, when asked (a button?) will copy the abstract, paste it in MSword, run a search (in MSword) and highlight each of the words (red, fox)? I can then quickly see the words (red, fox) in MSword, read the words nearby and get the required info without reading the whole abstract.

    Ideally the macro would run on one cell at a time on demand.

    Thoughts? Any help would be greatly appreciated.

  2. #2
    Forum Expert
    Join Date
    02-14-2009
    Location
    .
    MS-Off Ver
    ................
    Posts
    2,840

    Re: Marco; extract to Word and highlight constant search terms?

    Chopped out of another app - and it uses IE rather than Word (Simpler to manipulate the text).

    Sheet has random text in Col P. The count of the number of characters is shown in Col A. The last row has 3000+ chars just to show workings with a lot of text.

    Click the button to display userform. This shows the number of matches (up to 5, easily changed) in Col P for a list of defined words (or phrases).

    If the Count is > 0 then a 'Review' button is enabled.

    The Review button displays the text in Internet Explorer with each word or phrase highlighted. Note this uses the HTML5 'mark' tag - if running on an older version of IE then this may not work, but it is easily changed.

    Meant as an example only, not a finished app.
    Attached Files Attached Files

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Marco to Open all contents (.xlsm) in a folder and search each file for a word
    By Mr.Post in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 07-11-2014, 04:08 PM
  2. Search and highlight word in cell
    By ShailShin in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 06-18-2014, 10:30 AM
  3. Replies: 2
    Last Post: 01-16-2014, 07:25 PM
  4. Search for a word in a column and extract the word
    By Abishekar in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 12-17-2012, 09:30 AM
  5. [SOLVED] vba to search word and extract following 3 words
    By sausis in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 11-30-2012, 03:39 AM
  6. Search a word and highlight
    By karinos57 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-23-2008, 04:48 PM
  7. Search for and extract word from a cell
    By hmatharo in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-30-2007, 10:21 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1