You could use:

1 - InStrRev(s, "\")
2 - Call the shell function PathRemoveFileSpec().

Search the forum for these if you need more help or examples.