Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

String Manipulation

Status
Not open for further replies.

Loggerhead2000

Programmer
Mar 23, 2003
11
US
Hi, I'm tring to just get a file name from a file path
I have this C:\Windows\folders\file.txt,want to Get this File.txt

I think this is posible but not sure how to do any suggestions would be great, thanks Timmeh
 
FileName = Dir(FilePath)
-OR-
Dim V As Variant
V = Split(FilePath, "\")
FileName = V(UBound(V))
 

Try this...
[tt]
Dim S As String
S = "C:\Windows\folders\file.txt"
S = Mid(S, InStrRev(S, "\") + 1)
Debug.Print S
[/tt]

Good Luck

 
Did you check the FAQ section before asking?

Try faq222-3420


________________________________________________________________
If you want to get the best response to a question, please check out FAQ222-2244 first

'People who live in windowed environments shouldn't cast pointers.'
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top