get the last part of a long string vb6

example string;
C:\Program Files (x86)\Microsoft Visual Studio\VB10\Tasks\Personal\Tasks\11-11-2015.rtf
i want to return the part after the last backslash (\)
return this 11-11-2015.rtf
how to do this ?
isnoend2001Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Martin LissOlder than dirtCommented:
Dim StrParts() As String

StrParts = Split(x, "\")
MsgBox StrParts(UBound(StrParts))

Open in new window

Where "x" is your string.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Guy Hengel [angelIII / a3]Billing EngineerCommented:
by using the mid combined with instrrev function:
https://msdn.microsoft.com/en-us/library/t2ekk41a%28v=vs.90%29.aspx


MID(yourstring, INSTRREF( yourstring, "\") + 1)
0
Martin LissOlder than dirtCommented:
Guy means  INSTRREV not  INSTRREF.
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

Martin LissOlder than dirtCommented:
Yes another way.

MsgBox Right(x, Len(x) - InStrRev(x, "\"))
0
Guy Hengel [angelIII / a3]Billing EngineerCommented:
sorry for the typo. first post after some weeks of abscense (and in the middle of the night for me) ... ;-)
0
isnoend2001Author Commented:
thanks works good
0
ArkCommented:
Just my 2 cents :)
Dim fso as Object
Set fso = CreateObject("Scripting.FileSystemObject")
fileName = fso.GetFilename(path)

Open in new window

Private Declare Function PathFindFileName Lib "shlwapi" _
   Alias "PathFindFileNameA"  (ByVal pPath As String) As Long
  
Private Declare Function lstrcpyA Lib "kernel32" (ByVal RetVal As String,  _
ByVal Ptr As Long) As Long
                        
Private Declare Function lstrlenA Lib "kernel32" (ByVal Ptr As Any) As Long
 
Public Function GetFilePart(ByVal sPath As String) As String
   GetFilePart = GetStrFromPtrA(PathFindFileName(sPath))
End Function

Private Function GetStrFromPtrA(ByVal lpszA As Long) As String
   GetStrFromPtrA = String$(lstrlenA(ByVal lpszA), 0)
   Call lstrcpyA(ByVal GetStrFromPtrA, ByVal lpszA)
End Function

Open in new window

0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.