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 for existence of a file

Hi DJS,

Try something like

'=============
Public Sub TesterA01()
Dim FSO As Object
Dim oFile As Object
Dim sStr As String
Const sPath As String = "C:\Data\myBook.xls" '<<=== CHANGE


Set FSO = CreateObject("Scripting.FileSystemObject")
Set oFile = FSO.GetFile(sPath)

With oFile
sStr = "Date Created " & .DateCreated _
& vbNewLine _
& "Last Accessed " & .DateLastAccessed _
& vbNewLine & "Last Modified " _
& .DateLastModified
End With
MsgBox Prompt:=sStr, Title:=sPath
End Sub
'<<=============


---
Regards,
Norman


"DKS" wrote in message
...
How can I check for the existence of a file (I can provide the path and
the
file name to look for)?

Once I have checked the existence of the file, how can I look up various
attributes of the file, e.g. creation date, last modified date, last
accessdate, etc.

many thanks in anticipation