ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Getting a File Date & Time stamp (https://www.excelbanter.com/excel-programming/322649-getting-file-date-time-stamp.html)

James

Getting a File Date & Time stamp
 
Hi
Is it possible to get a file date & time stamp info (any particular file
stored on harddrive) from within VBA. How??

Thats a lot for your help

James

sebastienm

Getting a File Date & Time stamp
 
Hi:
From the vba online help:
'------------------------------
Sub ShowFileInfo()
Dim fs, f, s
Set fs = CreateObject("Scripting.FileSystemObject")
Set f = fs.GetFile("E:\Computer\Archive\Graphics\VCRPause. bmp")
s = f.DateCreated
MsgBox s
End Sub
'-------------------------------

See online-help for the File Object.
Regards,
Sebastienm

"James" wrote:

Hi
Is it possible to get a file date & time stamp info (any particular file
stored on harddrive) from within VBA. How??

Thats a lot for your help

James


AA2e72E

Getting a File Date & Time stamp
 
Try:

Function TS()
Set fso = CreateObject("Scripting.FileSystemObject")
TS = fso.GetFile("c:\aa.txt").datecreated
Set fso = Nothing
End Function

NB: Modify the function so that the fully qualified name of your file is
passed in as an argument.

"James" wrote:

Hi
Is it possible to get a file date & time stamp info (any particular file
stored on harddrive) from within VBA. How??

Thats a lot for your help

James


Tom Ogilvy

Getting a File Date & Time stamp
 
VBA's function:

FileDateTime(pathname)

--
Regards,
Tom Ogilvy

"James" wrote in message
...
Hi
Is it possible to get a file date & time stamp info (any particular file
stored on harddrive) from within VBA. How??

Thats a lot for your help

James




quartz[_2_]

Getting a File Date & Time stamp
 
Tom,

Is there a similar function to retrieve the date and time a file was last
modified and by whom?

Thanks

"Tom Ogilvy" wrote:

VBA's function:

FileDateTime(pathname)

--
Regards,
Tom Ogilvy

"James" wrote in message
...
Hi
Is it possible to get a file date & time stamp info (any particular file
stored on harddrive) from within VBA. How??

Thats a lot for your help

James





Tom Ogilvy

Getting a File Date & Time stamp
 
If you mean any file:

See Ivan Moala's page
http://www.xcelfiles.com/Shell32_01.html
http://www.xcelfiles.com/Shell32_02.html

--
Regards,
Tom Ogilvy

"quartz" wrote in message
...
Tom,

Is there a similar function to retrieve the date and time a file was last
modified and by whom?

Thanks

"Tom Ogilvy" wrote:

VBA's function:

FileDateTime(pathname)

--
Regards,
Tom Ogilvy

"James" wrote in message
...
Hi
Is it possible to get a file date & time stamp info (any particular

file
stored on harddrive) from within VBA. How??

Thats a lot for your help

James








All times are GMT +1. The time now is 12:40 PM.

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