locked
Is there a method to reverse a string in VBA Library? RRS feed

  • Question

  • I'm trying to grab a file name from a ListBox.ItemData(index) string. Which looks something like "C:\Users\Public\Picture.pdf"

    If I could reverse the string, I could locate the position of the first instance of "\" and grab the name, but I can't find such a method. Does VBA have a method to reverse a string in its library? Or how would someone suggest the best way to get the file name and extension, given a dir such as this, in which I don't know the number of folders being drilled into.

    Tuesday, March 15, 2016 5:44 PM

Answers

  • Hi. Look up the InStrRev() function. Hope that helps...
    • Marked as answer by HTHP Tuesday, March 15, 2016 5:56 PM
    Tuesday, March 15, 2016 5:47 PM

All replies

  • Hi. Look up the InStrRev() function. Hope that helps...
    • Marked as answer by HTHP Tuesday, March 15, 2016 5:56 PM
    Tuesday, March 15, 2016 5:47 PM
  • Thanks!
    I think its just one of those days when the brain isn't processing. StrReverse() popped up on left of thread when I posted this. InStrRev() is even better.

    I need to add some custom water cooling to my brain today! It must be over heating.
    Tuesday, March 15, 2016 5:55 PM
  • Hi. Glad to hear you got it sorted out. Good luck with your project.
    Tuesday, March 15, 2016 6:00 PM