vba check if file exists
Public Function IsFile(s) IsFile = CreateObject("Scripting.FileSystemObject").FileExists(s) End Function
Source: stackoverflow.com
excel vba existence of a file
' Existence of a file If Dir("C:\myDirectory\myFile", vbDirectory) = vbNullString Then MsgBox "Doesn't exists" Else MsgBox "Exists" End If
vba file exists
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
Source: stackoverflow.com