Avatar of Sandra Smith
Sandra SmithFlag for United States of America

asked on 

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
Microsoft DevelopmentMicrosoft ApplicationsMicrosoft Access

Avatar of undefined
Last Comment
Sandra Smith
ASKER CERTIFIED SOLUTION
Avatar of Rey Obrero (Capricorn1)
Rey Obrero (Capricorn1)
Flag of United States of America image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Avatar of als315
als315
Flag of Russian Federation image

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

Avatar of Sandra Smith
Sandra Smith
Flag of United States of America image

ASKER

This worked.  The Split did not return what I needed.  Thank you both.
Microsoft Access
Microsoft Access

Microsoft Access is a rapid application development (RAD) relational database tool. Access can be used for both desktop and web-based applications, and uses VBA (Visual Basic for Applications) as its coding language.

226K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo