Results 1 to 8 of 8

Thread: InStrExact - Find Location Of A Word, As A Word, Not Embedded Within Another Word

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Forum Guru Rick Rothstein's Avatar
    Join Date
    Feb 2012
    Posts
    662
    Rep Power
    15
    I posted this article two-and-quarter years ago and, until now, no one noticed that my code does not work correctlyy for the example I give in the beginning description!??!! Someone in another forum posted that all he could get InStrExact to return when looking for "Don" in "Don't tell me, but your name is Don, right?" is the number 1, not 33. And when I tried it, that is what I got as well. Now I can almost understand my missing this... almost, but not one of the 3,148 people who have viewed the article as of today noticed it until now? Anyway, I have posted corrected code in Message #1, so if you are currently using the original function, please replace it with what is now posted there.

  2. #2
    Junior Member
    Join Date
    Dec 2012
    Posts
    12
    Rep Power
    0
    Quote Originally Posted by Rick Rothstein View Post
    I posted this article two-and-quarter years ago and, until now, no one noticed that my code does not work correctlyy for the example I give in the beginning description!??!! Someone in another forum posted that all he could get InStrExact to return when looking for "Don" in "Don't tell me, but your name is Don, right?" is the number 1, not 33. And when I tried it, that is what I got as well. Now I can almost understand my missing this... almost, but not one of the 3,148 people who have viewed the article as of today noticed it until now? Anyway, I have posted corrected code in Message #1, so if you are currently using the original function, please replace it with what is now posted there.
    Hi Mr. Rick
    I tested your great UDF function and noticed that case sensitive doesn't work properly
    Code:
    Sub TestRun()
        MsgBox InStrExact(1, "Don't tell me, but your name is Don, right?", "Don", 1)
    End Sub
    The optional argument case sensitive .. I tried to put 0 and 1 .. I got the same result 33
    Is there any thing wrong about it?

  3. #3
    Forum Guru Rick Rothstein's Avatar
    Join Date
    Feb 2012
    Posts
    662
    Rep Power
    15
    Quote Originally Posted by KingTamo View Post
    Hi Mr. Rick
    I tested your great UDF function and noticed that case sensitive doesn't work properly
    Code:
    Sub TestRun()
        MsgBox InStrExact(1, "Don't tell me, but your name is Don, right?", "Don", 1)
    End Sub
    The optional argument case sensitive .. I tried to put 0 and 1 .. I got the same result 33
    Is there any thing wrong about it?
    Since the word you are searching for has the same letter casing as the word in the text, a case sensitive and case insensitive search will always return the same value. Try changing the red highlighted word to "don" instead of "Don" and then try 0 and 1 for the 4th argument to see the difference

Similar Threads

  1. Loop through a folder and find word
    By k0st4din in forum Excel Help
    Replies: 7
    Last Post: 12-08-2012, 02:22 PM
  2. Replies: 1
    Last Post: 10-16-2012, 01:53 PM
  3. Embed ms project in a table in ms word
    By hometech in forum Word Help
    Replies: 6
    Last Post: 09-27-2012, 12:57 PM
  4. How to extract all text from a word file?
    By vsrawat in forum Word Help
    Replies: 3
    Last Post: 09-25-2012, 10:24 PM
  5. Replies: 2
    Last Post: 09-25-2012, 01:30 AM

Tags for this Thread

Posting Permissions

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