' Проверка пути
Public Function ExistDir(ByVal exName As String, Optional attr As Integer = 0, Optional Echo As Boolean = True) As String
On Local Error GoTo Bug
If Len(exName) < 2 Then GoTo Bug
If Right(exName, 1) = "\" Then
exName = Left(exName, Len(exName) - 1)
End If
If Left(exName, 2) = "\\" Then
exName = exName + "\" ' if net
ElseIf Left(exName, 1) = "\" Then
exName = VB.App.Path & exName ' if not full adress
ElseIf Dir(exName, attr) = "" Then
exName = VB.App.Path & "\" & exName ' etc
' ElseIf Dir(exName, attr) <> "" Then
Else
ExistDir = exName
Exit Function
End If
If Dir(exName, attr) <> "" Then: ExistDir = exName
Exit Function
Bug:
If Echo = True Then: Call MsgBox("Файла [" & exName & "] не существует", vbInformation, "Внимание!")
End Function