Solved

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

Posted on 2004-03-29
5
282 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
  • 3
5 Comments
 
LVL 35

Expert Comment

by:[ fanpages ]
Comment Utility
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
Comment Utility
tnx fp, it works
0
 
LVL 49

Accepted Solution

by:
Ryan Chong earned 125 total points
Comment Utility
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 ]
Comment Utility
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 ]
Comment Utility
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

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

744 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now