Replace last character in string if it is "\"
Posted on 2007-11-27
I have a form where the user can select a network directory. I have a nice little browse button for them to use, but of course they can type it in as well. I just need to check the string they type in and remove the last character if it is "\". I tried:
Dim varFolderName As String
varFolderName = txtSharedFolder.Value, "\", "", Len(txtSharedFolder.Value) - 1)
But the value it returns is missing everything up to Len(txtSharedFolder.Value) - 1. Which in retrospect makes sense. Now I'm just drawing a blank on what to do. If there is a way to search from right to left in the string I could use the count function. Or maybe there is just a better way to approach it completely. Any suggestions would be helpful.