Home Privacy Policy Feedback Link to us Site Map Forums

Excel: FileDateTime Function (VBA only)


In Excel, the FileDateTime function returns the date and time of when a file was created or last modified.

The syntax for the FileDateTime function is:

FileDateTime ( file_path )

file_path is the path to a file name that you wish to retrieve the created or last modified date for.


Applies To:

  • Excel 2007, Excel 2003, Excel XP, Excel 2000

For example:

FileDateTime("C:\instructions.doc") would return 6/1/2004 7:40:18 PM
FileDateTime("H:\Documents\Supplies.xls") would return 7/3/2004 3:12:14 PM

VBA Code

The FileDateTime function can be used in VBA code. For example:

Dim LResult As Date

LResult = FileDateTime("C:\instructions.doc")

In this example, the variable called LResult would now contain the create or last modified date for the instructions.doc file.