ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Formula for file modified date (https://www.excelbanter.com/excel-discussion-misc-queries/182407-formula-file-modified-date.html)

Pastel Hughes

Formula for file modified date
 
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?

Mike H

Formula for file modified date
 
Maybe this

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

"Pastel Hughes" wrote:

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?


Mike H

Formula for file modified date
 
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

"Pastel Hughes" wrote:

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?


Pastel Hughes

Formula for file modified date
 
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?

"Mike H" wrote:

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

"Pastel Hughes" wrote:

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?



All times are GMT +1. The time now is 01:40 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com