Colin,
First, find the position of the last slash in the string, everything
after that is the filename:
Function GetFile(inPathFile As String) As String
Dim iLastSlash As Integer
Do Until (InStr(iLastSlash + 1, inPathFile, "\")) = 0
iLastSlash = InStr(iLastSlash + 1, inPathFile, "\")
Loop
GetFile = Right(inPathFile, Len(inPathFile) - iLastSlash)
End Function
Regards, GJ
ColinWard <je*********@hotmail.com> wrote in message news:<41**********************@news.newsgroups.ws> ...
Hello.
I use the following line which returns the path of a file and adds it to
a listbox. How can I modify this line so that it only returns the
filename and not the entire path?
--> TxtAttachment.AddItem (vrtSelectedItem)
vrtSelectedItem is the variable which contains the path.
Thank you
Colin
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!