View Single Post
 
Old 11-19-2014, 11:52 PM
gmayor's Avatar
gmayor gmayor is offline Windows 7 64bit Office 2010 32bit
Expert
 
Join Date: Aug 2014
Posts: 4,101
gmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud of
Default

What I think you are looking for is:

Code:
Option Explicit
Function TestFileExistence(strFilename) As Boolean
Dim FSO As New FileSystemObject
Dim f As Object
    On Error GoTo Not_Found
    Set f = FSO.GetFile(strFilename)
    If (FSO.FileExists(strFilename)) Then
        If (DateDiff("d", f.DateLastModified, Now()) = 0) Then
            TestFileExistence = True
        End If
    End If
lbl_Exit:
    Set f = Nothing
    Exit Function
Not_Found:
    Resume lbl_Exit
End Function

Sub Macro1()
MsgBox TestFileExistence("C:\Path\Filename.ext")
End Sub
__________________
Graham Mayor - MS MVP (Word) (2002-2019)
Visit my web site for more programming tips and ready made processes www.gmayor.com
Reply With Quote