View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Norman Jones Norman Jones is offline
external usenet poster
 
Posts: 5,302
Default Check File Existence

Hi Catalin,

Try:
'=============
Public Function FileExists(sPath As String, _
Optional sFName As String) As Boolean
FileExists = Len(Dir(sPath & sFName)) 0
End Function
'<<=============

An example of usage might be:
'=============
Sub TestIt()
MsgBox FileExists("C:\MyFolder\", "aBook.xls")
End Sub
'<<=============


---
Regards,
Norman



"Catalin" wrote in message
...
Hi all. How do I check in VBA Excel the existence of a specified file in a
specified directory and display its status. Thanks