VB Code:
  1. Public Declare Function PathFileExists Lib "shlwapi.dll" _
  2.   Alias "PathFileExistsA" (ByVal pszPath As String) As Long
  3.  
  4. Public Function FileExists(strFileName As String) As Boolean
  5.  
  6.     If PathFileExists(strFileName) = 1 Then
  7.  
  8.         FileExists = True
  9.  
  10.     Else
  11.  
  12.         FileExists = False
  13.  
  14.     End If
  15.  
  16. End Function
  17.  
  18. ' Usage
  19.  
  20. If FileExists("c:\test.text") = False Then
  21.  
  22. Msgbox "File Does not Exist"
  23.  
  24. End If