PDA

View Full Version : find the file


Keltoi
06-11-2003, 05:16 PM
Hi, quick an simple (I think).

I need to print the file name only from a string like the following:
C:\directory\some\dir\myfile.txt
so that only "myfile.txt" (or whatever) is printed.

Any ideas?

Thanks

Justin

oracleguy
06-11-2003, 06:04 PM
Dim strMyString, strNewString

strMyString = "C:\directory\some\dir\myfile.txt"

strNewString = Mid(strMyString, InStrRev(strMyString, "\") + 1)

That should do it.

Keltoi
06-11-2003, 06:15 PM
works a treat :D thanks oracleguy:thumbsup: