VBA to check if a file exists within a folder.  Update strpath with your filepath.  And update filecheck with your filename.  VBA will then check if that file exists within the designated folder.


Dim sFile As String

strpath = "Z:\Downloads\JSON"
If Right(strpath, 1) <> "\" Then strpath = strpath + "\"
ChDrive "Z:\"
ChDir strpath
strextend = Dir("*.*")
filecheck = "Filename.json"
Do While strextend <> ""

sFile = strpath & strextend
checkFile = strpath & filecheck
Set FSO = CreateObject("Scripting.FileSystemObject")
If FSO.FileExists(checkFile) Then
MsgBox "FileExists=TRUE"
MsgBox "FileExists=FALSE"
End If

strextend = Dir
[efb_likebox fanpage_url="https://www.facebook.com/vbamarket/" box_width="840" box_height=340"" responsive="1" show_faces="1" show_stream="1" hide_cover="1" small_header="0" hide_cta="0" locale="en_US"]