VBA Sprawdź, czy plik istnieje
Public Function IsFile(s)
IsFile = CreateObject("Scripting.FileSystemObject").FileExists(s)
End Function
Excel Hero
Public Function IsFile(s)
IsFile = CreateObject("Scripting.FileSystemObject").FileExists(s)
End Function
' Existence of a file
If Dir("C:\myDirectory\myFile", vbDirectory) = vbNullString Then
MsgBox "Doesn't exists"
Else
MsgBox "Exists"
End If
Sub test()
thesentence = InputBox("Type the filename with full extension", "Raw Data File")
Range("A1").Value = thesentence
If Dir(thesentence) <> "" Then
MsgBox "File exists."
Else
MsgBox "File doesn't exist."
End If
End Sub