#1
|
|||
|
|||
obtain file creation date using vba
i have a VBA application which imports 4 xls files for processing. i need to check that the user is importing concurrent files. I would like to read the creation date of the imported files as one of the validity checks. Have searched the VBA help files but can't find a solution. Any ideas?
|
#2
|
||||
|
||||
You can do that with code like:
Code:
Sub Test() ' get the file's Creation date. Dim FSO As Object Dim oItem As Object Dim StrFile As String StrFile = ActiveWorkbook.FullName If FSO Is Nothing Then Set FSO = CreateObject("Scripting.FileSystemObject") Set oItem = FSO.GetFile(StrFile) MsgBox "The date & time the file:" & vbCr & StrFile & vbCr & "was created is: " & oItem.DateCreated End Sub
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#3
|
|||
|
|||
file creation date in vba
That's great. Many thanks.
Have tested and works fine. Unfortunately I've realised that I'm working blind as I don't understand how the code works. I have tried using some of the key words in the help file but get no return. Where can I read more about FSO Last edited by mikec; 02-01-2013 at 02:41 AM. Reason: supplementary question |
Tags |
file date vba |
Thread Tools | |
Display Modes | |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Form file timesheet, auto fill date from calander | jkeeney | Word | 1 | 03-21-2012 12:21 AM |
How to obtain the column “C” from column “A” and “B”? | Jamal NUMAN | Excel | 2 | 02-26-2012 01:28 PM |
Insert date when save file | gg80 | Excel Programming | 3 | 01-29-2011 08:36 AM |
How to update automatically the “file name” as we do for the “Date”? | Jamal NUMAN | Word | 2 | 01-06-2011 02:43 PM |
Anyway to determine time/date of text creation? | pureride | Word | 1 | 01-05-2010 02:09 PM |