One way that is working form 97-2003
Sub test()
Dim Str As String
Dim vArr As Variant
Dim sFname As String
Dim xFile As String
Dim XPath As String
Str = "D:\Development Path\Main Files\Test Procedures\Sample Data.mdb"
vArr = Split97(Str, "\")
sFname = vArr(UBound(vArr))
XPath = Left(Str, Len(Str) - Len(sFname))
xFile = sFname
MsgBox xFile
MsgBox XPath
End Sub
Function Split97(sStr As Variant, sdelim As String) As Variant
' Tom Ogilvy
Split97 = Evaluate("{""" & _
Application.Substitute(sStr, sdelim, """,""") & """}")
End Function
--
Regards Ron de Bruin
(Win XP Pro SP-1 XL2000-2003)
www.rondebruin.nl
"Nigel" wrote in message ...
Hi All
What is the the most efficient way of of extracting the path and file
elements from a text string?
I have a full path string such as (the path length and file type can change)
D:\Development Path\Main Files\Test Procedures\Sample Data.mdb
What I would like to end up with is two string variables xPath and xFile
xPath = D:\Development Path\Main Files\Test Procedures\
xFile = Sample Data.mdb
TIA
Cheers
Nigel
----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeed.com The #1 Newsgroup Service in the World! 100,000 Newsgroups
---= 19 East/West-Coast Specialized Servers - Total Privacy via Encryption =---