getting the date a directory was created

  • Thread starter Thread starter Steven Revell
  • Start date Start date
S

Steven Revell

Hi,

I want to be able to find out the data that a directory
was created using VBA. Is it possible?

Thanks for any help,

Steven
 
active the Microsoft Scripting Runtime in references

then
Sub DirDate()
Dim fso As New Scripting.FileSystemObject
Dim fld As Scripting.Folder
Set fld = fso.GetFolder("c:\windows")
MsgBox fld.DateCreated
End Sub


keepITcool

< email : keepitcool chello nl (with @ and .) >
< homepage: http://members.chello.nl/keepitcool >
 
I get an error "object variable or with variable not set"
at this line:

Set fld = fso.GetFolder("c:\windows")

Cheers for the help,
Steven
 
Did you create a reference to the Microsoft Scripting Runtime in the
Tools=>References portion of the VBE with your workbook as the active
workbook. If not, you need to.
 
This worked if you don't want to create the reference:

Sub DirDate1()
Dim fso As Object
Dim fld As Object
Set fso = CreateObject("Scripting.Filesystemobject")
Set fld = fso.GetFolder("c:\winnt")
MsgBox fld.DateCreated
End Sub

nonetheless, either with a reference or without, I couldn't duplicate your
error message with either verions of the code. If the directory didn't
exist, I got a 76 error (path not found) and if I didn't have the reference
and used the original, I got a undefined type error.
 
I hadn't done it for the activeworkbook. I had a different workbook
selected when i added the reference.

Thanks for your help Tom and KeepItCool

Steven Revell
Applications Development & Support
Covance Laboratories Europe, UK
 
Back
Top