ник: osmor
откопал Public Function FilePath(strFullName As String, blnDir As Boolean) As String
*******************************************************************
Author : Oleg Smorchkov
Date : 9 Декабрь 1998
Comments : Возвращает из строки полного имени файла(strFullName) имя файл (по умолчанию) или путь к файлу если blnDir = True
********************************************************************* On Local Error GoTo FilePath_ERR
Dim intPos As Integer, i As Integer
Dim strPath As String, strName As String
intPos = -1
For i = Len(strFullName) To 1 Step -1
If Mid$(strFullName, i, 1) = "" Then
intPos = i
Exit For
End If
Next
If intPos <> -1 Then
strPath = Left$(strFullName, intPos - 1)
strName = Right$(strFullName, Len(strFullName) - intPos)
Else
strName = strFullName
End If
FilePath = IIf(blnDir, strPath, strName)
FilePath_EXIT:
Exit Function
FilePath_ERR:
MsgBox "Ошибка #: " & Format$(Err.Number) & vbCrLf & Err.Description, vbInformation, "FilePath"
Resume FilePath_EXIT
End Function