none
Find a word in Excel

    Question

  • Hi all,
        I am currently trying to search and find a word in the excel sheet and then color them. I used Excel.range.Find() as the following:
               currentFind = this.currentSelection.Find(toFind, missing,
                         Excel.XlFindLookIn.xlValues, Excel.XlLookAt.xlPart,
                         Excel.XlSearchOrder.xlByRows, Excel.XlSearchDirection.xlNext, true,
                         missing, missing);

       But in the result, the word that i found is not exactly match. For example,
        if i want to find "all",  in the result "installation" was showed up since it contain "all".
        I don't want it and just want exactly match case.

       How can i solve this problem?
       Thanks advanced!

    pkminicooper
    Monday, April 27, 2009 7:36 PM

Answers

  • There isn't an exact match option.  A basic rule of thumb is, if it doesn't exist in the actual product, it doesn't exist in interop.  This feature doesn't exist in the product in the search window, so you'll have to custom develop the solution for yourself. Check to ensure one of three things:

    1. Either the text found is at the beginning followed by a space or
    2. The text found is at the end preceded by a space.
    3. The text is all that is contained in the cell.
    4. The text is in the middle, preceded and followed by a space.
    David Morton - http://blog.davemorton.net/
    • Marked as answer by pkminicooper Monday, April 27, 2009 9:42 PM
    Monday, April 27, 2009 7:54 PM
    Moderator

All replies

  • I don't know whether there is an exact match option is there or not.

    One workaround that comes to my mind is check whether the current find is a word or not. If its a word mean it is surrounded with space then apply color.
    Thanks, A.m.a.L | [Remember to click "mark as answered" when you get a correct reply to your question]
    Monday, April 27, 2009 7:51 PM
  • There isn't an exact match option.  A basic rule of thumb is, if it doesn't exist in the actual product, it doesn't exist in interop.  This feature doesn't exist in the product in the search window, so you'll have to custom develop the solution for yourself. Check to ensure one of three things:

    1. Either the text found is at the beginning followed by a space or
    2. The text found is at the end preceded by a space.
    3. The text is all that is contained in the cell.
    4. The text is in the middle, preceded and followed by a space.
    David Morton - http://blog.davemorton.net/
    • Marked as answer by pkminicooper Monday, April 27, 2009 9:42 PM
    Monday, April 27, 2009 7:54 PM
    Moderator
  • Thanks a lot. Will do.
    Monday, April 27, 2009 9:42 PM