Sub test()
res = FileExist("объект_т" + MyName + ".xls")
End Sub
Function FileExist(filename As String) As Boolean
On Error Resume Next
FileExist = Dir$(filename) <> ""
If Err.Number <> 0 Then FileExist = False
On Error GoTo 0
End Function
'==========================================
'http://bbs.vbstreets.ru/viewtopic.php?f=1&t=17961
Public Function bFileExists(sFile As String) As Boolean
'Проверка наличия файла.
'Подключить References -> Microsoft Scripting Runtime
Dim f As New Scripting.FileSystemObject
If f.FileExists(sFile) = True Then
bFileExists = True
Else
bFileExists = False
End If
End Function
'==========================================
Public Function bFileExists(sFile As String) As Boolean
If Dir$(sFile) <> "" Then bFileExists = True Else _
bFileExists = False
End Function
'==========================================
'http://bbs.vbstreets.ru/viewtopic.php?f=1&t=19186
Dim fso As New FileSystemObject
Set fso = New FileSystemObject
MsgBox fso.FolderExists("путь к папке")
MsgBox fso.FileExists("путь к файлу")
Set fso = Nothing