Re: Extract file name
- From: "Rick Rothstein \(MVP - VB\)" <rick.newsNO.SPAM@xxxxxxxxxxxxxxxxxx>
- Date: Sat, 9 Aug 2008 04:04:41 -0400
Here is a UDF which does not rely on a scripting object (meaning it should be a little bit faster)...
Function GetFileName(strFilePath)
GetFileName = Split(strFilePath, "\")(UBound(Split(strFilePath, "\")))
End Function
Rick
"Dana DeLouis" <ddelouis@xxxxxxxxxxxxx> wrote in message news:4C27FC14-76EF-4B2D-82DD-76333473A906@xxxxxxxxxxxxxxxx
What function would extract the name: 84DTCC 2008_05
If you would like a UDF...
Function GetFileName(strFilePath)
GetFileName = CreateObject("Scripting.FileSystemObject").GetFileName(strFilePath)
End Function
Sub TestIt()
Dim s As String
s = "G:\CorporateAcct\SMR\Special\Support\84DTCC 2008_05.pdf"
Debug.Print GetFileName(s)
End Sub
Returns:
84DTCC 2008_05.pdf
--
HTH :>)
Dana DeLouis
"Steven" <Steven@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message news:00D65A82-8215-4A8C-9934-5A5C6DA93D0E@xxxxxxxxxxxxxxxxWhat function would extact the name: 84DTCC 2008_05
out of this.
G:\CorporateAcct\SMR\Special\Support\84DTCC 2008_05.pdf
Note that the directory and subdirectory(ies) will not be constant (ie.
some may have more or less "\" )
Thank you,
Steven
.
- Follow-Ups:
- Re: Extract file name
- From: Rick Rothstein \(MVP - VB\)
- Re: Extract file name
- References:
- Extract file name
- From: Steven
- Re: Extract file name
- From: Dana DeLouis
- Extract file name
- Prev by Date: Re: Pls help with Excel Function
- Next by Date: Re: Extract file name
- Previous by thread: Re: Extract file name
- Next by thread: Re: Extract file name
- Index(es):
Loading