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?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
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.

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)
Martin LissOlder than dirtCommented:
Guy means  INSTRREV not  INSTRREF.
Big Business Goals? Which KPIs Will Help You

The most successful MSPs rely on metrics – known as key performance indicators (KPIs) – for making informed decisions that help their businesses thrive, rather than just survive. This eBook provides an overview of the most important KPIs used by top MSPs.

Martin LissOlder than dirtCommented:
Yes another way.

MsgBox Right(x, Len(x) - InStrRev(x, "\"))
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) ... ;-)
isnoend2001Author Commented:
thanks works good
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

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.