Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 01-30-2013, 05:51 AM
mikec mikec is offline obtain file creation date using vba Windows XP obtain file creation date using vba Office 2010 32bit
Advanced Beginner
obtain file creation date using vba
 
Join Date: Nov 2012
Posts: 30
mikec is on a distinguished road
Question 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?
Reply With Quote
  #2  
Old 02-01-2013, 01:47 AM
macropod's Avatar
macropod macropod is offline obtain file creation date using vba Windows 7 64bit obtain file creation date using vba Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,953
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

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]
Reply With Quote
  #3  
Old 02-01-2013, 02:30 AM
mikec mikec is offline obtain file creation date using vba Windows XP obtain file creation date using vba Office 2010 32bit
Advanced Beginner
obtain file creation date using vba
 
Join Date: Nov 2012
Posts: 30
mikec is on a distinguished road
Smile 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
Reply With Quote
Reply

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
obtain file creation date using vba Insert date when save file gg80 Excel Programming 3 01-29-2011 08:36 AM
obtain file creation date using vba 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

Other Forums: Access Forums

All times are GMT -7. The time now is 10:48 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft