ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   getting the date a directory was created (https://www.excelbanter.com/excel-programming/277125-getting-date-directory-created.html)

Steven Revell

getting the date a directory was created
 
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

keepITcool

getting the date a directory was created
 
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


"Steven Revell" wrote:

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



Steven Revell

getting the date a directory was created
 
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


-----Original Message-----
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


"Steven Revell" wrote:

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


.


Tom Ogilvy

getting the date a directory was created
 
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.


"Steven Revell" wrote in message
...
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


-----Original Message-----
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


"Steven Revell" wrote:

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


.




Tom Ogilvy

getting the date a directory was created
 
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.

--
Regards,
Tom Ogilvy

"Tom Ogilvy" wrote in message
...
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.


"Steven Revell" wrote in message
...
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


-----Original Message-----
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


"Steven Revell" wrote:

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


.






Steven Revell

getting the date a directory was created
 
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

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!


All times are GMT +1. The time now is 01:17 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com