VBA: Split a path string

How many times do I end up re-writing this bit of code? Maybe next time I’ll come here and check my own blog and grab the following function:

Public Functon SplitFullPathName(sFileAndPathName as string, sFileName as string, sPathName as string)

sPathName = Left(sFileAndPathName, InStrRev(sFileAndPathName, “\” – 1)
sfileName = Mid(sFileAndPathName, InStrRev(sFileAndPathName, “\”) + 1)

End Function

Comments are closed.