Perhaps a FileSystemObject would be more to the point:
function GetPathAndFile(FullPath as String) as String
dim fileparts(1) as string
dim fso as new filesystemobject
fileparts(0) = fso.getabsolutepathname(FullPath)
fileparts(1) = fso.getbasename(FullPath)
GetPathAndFile = join(fileparts,"^") 'or whatever identifier you want to
use.
set fso = nothing
end function
You can split the path and file out with:
whatever 1 by 2 array you want = split(GetPathAndFile(FullPath)).
Neal Quinn
Montefiore Medical Center
----- Original Message -----
From: Lawrence, Mitchell
To: [email protected]
Sent: Wednesday, December 05, 2007 3:08 PM
Subject: [Talk] Quick VBA question
Will this function return what is expected (see comments)
Function GetPathAndFile(FullPath As String)
' This function takes a FullPath and will return the Path and File from
that FullPath
' Ex: GetPathAndFile ("C:\Path\To\File.txt") will give
' SourcePath = "C:\Path\To"
' SourceFile = "File.txt"
Dim strFind As String
Do Until Left(strFind, 1) = "\"
iCount = iCount + 1
strFind = Right(FullPath, iCount)
If iCount = Len(FullPath) Then
Exit Do
End If
Loop
SourceFile = Right(strFind, Len(strFind) - 1)
SourcePath = Left(FullPath, Len(strFind))
End Function
Thank you,
Mitch Lawrence
Lead Applications Analyst
Technical Support - NPR/Automation
CHRISTUS Information Management
T: [EMAIL PROTECTED]
Send a "thank you" to someone!
<<image001.png>>
