Solved

Get the time and date when the file was generated in VB

Posted on 2004-03-29
5
287 Views
Last Modified: 2010-05-02
hi, experts, is there a way how to get the time and date of file when it was generated using VB6
0
Comment
Question by:jacristobal
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
5 Comments
 
LVL 35

Expert Comment

by:[ fanpages ]
ID: 10711244
Hi,

Please replace "filename.ext" with your chosen file, and remove the removes to "datLast_Accessed" and "datLast_Modified" if you are just interested in the "datCreated"...

  Dim datCreated                              As Date
  Dim datLast_Accessed                              As Date
  Dim datLast_Modified                              As Date

  Dim objFSO                                            As Object
  Dim objFSO_GetFile                                    As Object

  Set objFSO = CreateObject("Scripting.FileSystemObject")
  Set objFSO_GetFile = objFSO.GetFile("filename.ext")
 
  datCreated = objFSO_GetFile.DateCreated
  datLast_Accessed = objFSO_GetFile.DateLastAccessed
  datLast_Modified = objFSO_GetFile.DateLastModified
 
  Set objFSO_GetFile = Nothing
  Set objFSO = Nothing
 
BFN,

fp.
0
 

Author Comment

by:jacristobal
ID: 10711302
tnx fp, it works
0
 
LVL 52

Accepted Solution

by:
Ryan Chong earned 125 total points
ID: 10711312
Also :

Obtaining and Changing a File's Created, Accessed and Modified Dates
http://vbnet.mvps.org/code/fileapi/filedatetime.htm

Where this using APIs and without using FSO component
0
 
LVL 35

Expert Comment

by:[ fanpages ]
ID: 10820665
Hello jacristobal,

Was there a specific reason why you did not wish to use my proposal even though you replied to say "it works"?
0
 
LVL 35

Expert Comment

by:[ fanpages ]
ID: 10820666
Hello jacristobal,

Was there a specific reason why you did not wish to use my proposal even though you replied to say "it works"?
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses
Course of the Month11 days, left to enroll

628 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question