|
|
Папка по полному пути к файлу
Public Function FolderByPath(varPath As Variant, Optional bolRetNoSlash As Boolean = False) As String
On Error GoTo FolderByPath_Err
FolderByPath = Mid(varPath, 1, InStrRev(varPath, "\"))
If Dir(FolderByPath, vbDirectory) = "" Then FolderByPath = "C:"
If bolRetNoSlash = True Then
If Right(FolderByPath, 1) = "\" Then
FolderByPath = Mid(FolderByPath, 1, Len(FolderByPath) - 1)
End If
End If
FolderByPath_Bye:
Exit Function
FolderByPath_Err:
If bolRetNoSlash = False Then
FolderByPath = "C:\"
Else
FolderByPath = "C:"
End If
Resume FolderByPath_Bye
End Function
|
|