MyTetra Share
Делитесь знаниями!
Проверить существование файла - VBA 1
Время создания: 31.07.2019 22:55
Раздел: !Закладки - VBA - FSO
Запись: xintrea/mytetra_db_adgaver_new/master/base/1506482674ee0k3kh6is/text.html на raw.githubusercontent.com

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

 

Так же в этом разделе:
 
MyTetra Share v.0.59
Яндекс индекс цитирования