Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations sizbut on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Get a file datestamp prior to opening file.

Status
Not open for further replies.

pkmoore

Programmer
Sep 24, 2002
8
US
Can someone tell me how to check the datestamp of a file to be sure it is the current file (date of file matches today)prior to opening the file with Excel and manipulating it.

Thanks!!

Pat...
 
HI
Never quite understood specifically what's meant by date stamp but if you have a look at this link it may well solve your problem. Not something I've ever done and it's bad enough that I'm sat on this site on a Friday night blah blah blah!!


And it's raining
still, Happy Friday
;-) If a man says something and there are no women there to hear him, is he still wrong?
 
Pat,

Here's a sample procedure to determine the date/time stamp of any file:

Code:
Sub DateTimeStamp()
Dim FDateTime As Variant
  FDateTime = FileDateTime("Drive:\Directory\Filename.Ext")
  MsgBox FDateTime
End Sub

Insert the path/filename of interest. You can use other VBA functions to extract just the date portion, if necessary.

Or, as a function:

Code:
Function DateTimeStamp(FName as String) As Variant
  DateTimeStamp = FileDateTime(FName)
End Function


HTH
Mike
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top