Thread: Is it there?
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Steve Yandl Steve Yandl is offline
external usenet poster
 
Posts: 284
Default Is it there?

Sub CheckExistFile()
Set objFSO = CreateObject("Scripting.FileSystemObject")
strTestPath = "c:\temp\abc.txt "
If objFSO.FileExists(strTestPath) Then
MsgBox "Yes it exists"
Else
MsgBox "Sorry, it doesn't exist"
End If
End Sub

Steve Yandl



"MD" wrote in message
.. .
Good day all,

I'm looking for a simple code that checks if a file exists in a folder.

if c:\temp\abc.txt is there then
else exit sub

Regards

MD