I am attempting to rewrite some code that was using FileSearch for Excel 2003 VBA.  I'm attempting to call a function that should determine 1 or 0 and using an If statement I will execute some code or iterate to the next file.  
I am not returning the correct result from my function.
My code:
 Dim MyDir As String, Fn As String
 Dim MyFile As String
   MyDir = "C:Test\"
   Fn = "" & "" & Examiner & " " & MnName & " " & Yr & ".xls"
   MyFile = MyDir & """" & Fn & """"
    If FileThere(MyFile) Then
    MsgBox yes
    Else
    MsgBox Not there
    End If
    '''''''''''''''''
    Function FileThere(FileName As String) As Boolean
         FileThere = (Dir(FileName) > "")
    End Function
                Sub a()
MsgBox "test1 " & FileThere("c:\test1.bat")
MsgBox "k1" & FileThere("c:\k1")
End Sub
Function FileThere(FileName As String) As Boolean
     If (Dir(FileName) = "") Then
        FileThere = False
     Else:
        FileThere = True
     End If
End Function
                        If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With