Formula for file modified date

P

Pastel Hughes

I have an Excel file (call it file A) that draws information from a separate
file (file B)that gets updated periodically. I would like to have the date
that file B was last modified appear in a cell in file A. I've looked
through most of the excel formulas but can't seem to find one that will do
this. Is this doable?
 
M

Mike H

Maybe this

Sub sonic()
moddate = Format(FileDateTime("c:\book2.xls"), "m/d/yy h:m ampm")
MsgBox moddate
End Sub
Mike
 
M

Mike H

Apologies, you wanted it in a cell so put this in a regular module

Function moddate(myfile) As String
moddate = Format(FileDateTime(myfile), "m/d/yy h:m ampm")
End Function

call with

=moddate(full file path)

Mike
 
P

Pastel Hughes

Thanks Mike,

Before I try it out, does the "myfile" part have to include the whole path
if both files are in the same folder?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top