Return Path

Surjer

Registered User.
Local time
Today, 06:54
Joined
Sep 17, 2001
Messages
232
Is there anyway to strip a "path" of everything except the filename?

C:\12mc\1.bmp

will return

1.bmp

Never mind ----

Dir ("C:\12mc\1.bmp")


[This message has been edited by Surjer (edited 01-03-2002).]
 
Hello,

I run into the same problem, and someone send me a great module. Here it comes:

Public Function getfilename(pathname As Variant)
Dim myloop As Integer
Dim kees
For myloop = Len(pathname) To 1 Step -1
getfilename = getfilename & Mid(pathname, myloop, 1)

Next myloop
'use this in the debug window to get the filename: ?Right(pathname, (InStr(getfilename(pathname), "\") - 1))
'Example: ?Right("c:\test\kjdf\1234.jpg", (InStr(getfilename("c:\test\kjdf\1234.jpg"), "\") - 1))
End Function

Hope this helps.

Greetings,

Albert

[This message has been edited by raindrop3 (edited 01-07-2002).]
 

Users who are viewing this thread

Back
Top Bottom