Count characters after the last \ in a string

I have a directory with files of various names.  I need to strip out only the name of the file, but how to I get the name at the end of the directory/file name string.  For example, below
is a fulle name, but I only want what is after the Appr_, that is, I only need Appr_01AB55279_20060803.pdf

"\\sf4\user1\Private\ACH\OID\Repository\SCANNED DOCS\S\Appr_01AB55279_20060803.pdf"

Sandra
Sandra SmithRetiredAsked:
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.

Rey Obrero (Capricorn1)Commented:
try

Dim x, j As Integer
x = "\\sf4\user1\Private\ACH\OID\Repository\SCANNED DOCS\S\Appr_01AB55279_20060803.pdf"
j = Len(Mid(x, InStrRev(x, "\") + 1))

debug.print j

if you want to get the count after  "Appr_"

Dim x, j As Integer
x = "\\sf4\user1\Private\ACH\OID\Repository\SCANNED DOCS\S\Appr_01AB55279_20060803.pdf"
j = Len(Mid(x, InStrRev(x, "Appr_") + 5))
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
als315Commented:
Or:
Dim A() As String
Dim B As String
B = "\\sf4\user1\Private\ACH\OID\Repository\SCANNED DOCS\S\Appr_01AB55279_20060803.pdf"
A = Split(B, "\")
Debug.Print A(UBound(A))

Open in new window

0
Sandra SmithRetiredAuthor Commented:
This worked.  The Split did not return what I needed.  Thank you both.
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
Microsoft Development

From novice to tech pro — start learning today.