Search string beginning at the end

  • Thread starter Frederick Lorca
  • Start date
F

Frederick Lorca

I tried to find the answer to my question in this newsgroup's Google archive
but didn't find anything specific to my question.

Suppose I have a string that's 40 characters in length. Starting from the
end of the string, I want to search backwards to find the first occurence of
a blank space. How do I do this? Also, what is the Chr number for a blank
space?


Frederick Lorca
 
T

Tony Jollans

Provided you have Word 2000 or later you can use InStrRev

TestString = "Forty characters of text as illustration"
Msgbox "The last space is at position " & InStrRev(TextString, " ")
 
F

Frederick Lorca

Thank you.


Tony Jollans said:
Provided you have Word 2000 or later you can use InStrRev

TestString = "Forty characters of text as illustration"
Msgbox "The last space is at position " & InStrRev(TextString, " ")
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top