close

I want to return the File Property value of the excel file's last modified
date to a cell in a worksheet. Is this possible? I seem to recall that
there may be some way of using EXCEL4 macro, but cannot remember how. Or
perhaps there is an easier way.

Many thanks

It's the FileDateTime VBA function you are looking for. You can create a
simple UDF to reach time stamp on a worksheet.

Regards,
Stefi
?unc??ezt ?rta:

gt; I want to return the File Property value of the excel file's last modified
gt; date to a cell in a worksheet. Is this possible? I seem to recall that
gt; there may be some way of using EXCEL4 macro, but cannot remember how. Or
gt; perhaps there is an easier way.
gt;
gt; Many thanks

I found the following code on Microsoft.com, which is what I think I need.

1. But how would I then reference this information in a cell?
2. Also, how would I make this code generic so the filename would be
whatever the active file is?

Thanks!

Dim MyStamp
' Assume TESTFILE was last modified on February 12, 1993
' at 4:35:47 PM.
' Assume English/U.S. locale settings.
MyStamp = FileDateTime(quot;TESTFILEquot;)
' Returns quot;2/12/93 4:35:47 PMquot;.quot;Stefiquot; wrote:

gt; It's the FileDateTime VBA function you are looking for. You can create a
gt; simple UDF to reach time stamp on a worksheet.
gt;
gt; Regards,
gt; Stefi
gt;
gt;
gt;
gt; ?unc??ezt ?rta:
gt;
gt; gt; I want to return the File Property value of the excel file's last modified
gt; gt; date to a cell in a worksheet. Is this possible? I seem to recall that
gt; gt; there may be some way of using EXCEL4 macro, but cannot remember how. Or
gt; gt; perhaps there is an easier way.
gt; gt;
gt; gt; Many thanks

Install this UDF in a normal module:
Function MyStamp() Application.Volatile MyStamp = FileDateTime(ThisWorkbook.FullName)
End Function

and use it in a cell as an UDF:
= MyStamp()

Works only after the active workbook has been saved as an .XLS file.

Regards,
Stefi?avid L.??ezt ?rta:

gt; I found the following code on Microsoft.com, which is what I think I need.
gt;
gt; 1. But how would I then reference this information in a cell?
gt; 2. Also, how would I make this code generic so the filename would be
gt; whatever the active file is?
gt;
gt; Thanks!
gt;
gt; Dim MyStamp
gt; ' Assume TESTFILE was last modified on February 12, 1993
gt; ' at 4:35:47 PM.
gt; ' Assume English/U.S. locale settings.
gt; MyStamp = FileDateTime(quot;TESTFILEquot;)
gt; ' Returns quot;2/12/93 4:35:47 PMquot;.
gt;
gt;
gt; quot;Stefiquot; wrote:
gt;
gt; gt; It's the FileDateTime VBA function you are looking for. You can create a
gt; gt; simple UDF to reach time stamp on a worksheet.
gt; gt;
gt; gt; Regards,
gt; gt; Stefi
gt; gt;
gt; gt;
gt; gt;
gt; gt; ?unc??ezt ?rta:
gt; gt;
gt; gt; gt; I want to return the File Property value of the excel file's last modified
gt; gt; gt; date to a cell in a worksheet. Is this possible? I seem to recall that
gt; gt; gt; there may be some way of using EXCEL4 macro, but cannot remember how. Or
gt; gt; gt; perhaps there is an easier way.
gt; gt; gt;
gt; gt; gt; Many thanks

Hey Stefi--very cool! Thanks.
--
MikeC@Tranequot;Stefiquot; wrote:

gt; Install this UDF in a normal module:
gt; Function MyStamp()
gt; Application.Volatile
gt; MyStamp = FileDateTime(ThisWorkbook.FullName)
gt; End Function
gt;
gt; and use it in a cell as an UDF:
gt; = MyStamp()
gt;
gt; Works only after the active workbook has been saved as an .XLS file.
gt;
gt; Regards,
gt; Stefi
gt;
gt;
gt; ?avid L.??ezt ?rta:
gt;
gt; gt; I found the following code on Microsoft.com, which is what I think I need.
gt; gt;
gt; gt; 1. But how would I then reference this information in a cell?
gt; gt; 2. Also, how would I make this code generic so the filename would be
gt; gt; whatever the active file is?
gt; gt;
gt; gt; Thanks!
gt; gt;
gt; gt; Dim MyStamp
gt; gt; ' Assume TESTFILE was last modified on February 12, 1993
gt; gt; ' at 4:35:47 PM.
gt; gt; ' Assume English/U.S. locale settings.
gt; gt; MyStamp = FileDateTime(quot;TESTFILEquot;)
gt; gt; ' Returns quot;2/12/93 4:35:47 PMquot;.
gt; gt;
gt; gt;
gt; gt; quot;Stefiquot; wrote:
gt; gt;
gt; gt; gt; It's the FileDateTime VBA function you are looking for. You can create a
gt; gt; gt; simple UDF to reach time stamp on a worksheet.
gt; gt; gt;
gt; gt; gt; Regards,
gt; gt; gt; Stefi
gt; gt; gt;
gt; gt; gt;
gt; gt; gt;
gt; gt; gt; ?unc??ezt ?rta:
gt; gt; gt;
gt; gt; gt; gt; I want to return the File Property value of the excel file's last modified
gt; gt; gt; gt; date to a cell in a worksheet. Is this possible? I seem to recall that
gt; gt; gt; gt; there may be some way of using EXCEL4 macro, but cannot remember how. Or
gt; gt; gt; gt; perhaps there is an easier way.
gt; gt; gt; gt;
gt; gt; gt; gt; Many thanks

How can I add this to a page footer?

quot;MikeC@Tranequot; wrote:

gt; Hey Stefi--very cool! Thanks.
gt; --
gt; MikeC@Trane
gt;
gt;
gt; quot;Stefiquot; wrote:
gt;
gt; gt; Install this UDF in a normal module:
gt; gt; Function MyStamp()
gt; gt; Application.Volatile
gt; gt; MyStamp = FileDateTime(ThisWorkbook.FullName)
gt; gt; End Function
gt; gt;
gt; gt; and use it in a cell as an UDF:
gt; gt; = MyStamp()
gt; gt;
gt; gt; Works only after the active workbook has been saved as an .XLS file.
gt; gt;
gt; gt; Regards,
gt; gt; Stefi
gt; gt;
gt; gt;
gt; gt; ?avid L.??ezt ?rta:
gt; gt;
gt; gt; gt; I found the following code on Microsoft.com, which is what I think I need.
gt; gt; gt;
gt; gt; gt; 1. But how would I then reference this information in a cell?
gt; gt; gt; 2. Also, how would I make this code generic so the filename would be
gt; gt; gt; whatever the active file is?
gt; gt; gt;
gt; gt; gt; Thanks!
gt; gt; gt;
gt; gt; gt; Dim MyStamp
gt; gt; gt; ' Assume TESTFILE was last modified on February 12, 1993
gt; gt; gt; ' at 4:35:47 PM.
gt; gt; gt; ' Assume English/U.S. locale settings.
gt; gt; gt; MyStamp = FileDateTime(quot;TESTFILEquot;)
gt; gt; gt; ' Returns quot;2/12/93 4:35:47 PMquot;.
gt; gt; gt;
gt; gt; gt;
gt; gt; gt; quot;Stefiquot; wrote:
gt; gt; gt;
gt; gt; gt; gt; It's the FileDateTime VBA function you are looking for. You can create a
gt; gt; gt; gt; simple UDF to reach time stamp on a worksheet.
gt; gt; gt; gt;
gt; gt; gt; gt; Regards,
gt; gt; gt; gt; Stefi
gt; gt; gt; gt;
gt; gt; gt; gt;
gt; gt; gt; gt;
gt; gt; gt; gt; ?unc??ezt ?rta:
gt; gt; gt; gt;
gt; gt; gt; gt; gt; I want to return the File Property value of the excel file's last modified
gt; gt; gt; gt; gt; date to a cell in a worksheet. Is this possible? I seem to recall that
gt; gt; gt; gt; gt; there may be some way of using EXCEL4 macro, but cannot remember how. Or
gt; gt; gt; gt; gt; perhaps there is an easier way.
gt; gt; gt; gt; gt;
gt; gt; gt; gt; gt; Many thanks

Stefi
I came across yor response below and tried it just as shown. Unfortunately
it returns #NAME?.
Do I need to add something?
I assumed it would return the date without specifing the file name.
Rick

quot;Stefiquot; wrote:

gt; Install this UDF in a normal module:
gt; Function MyStamp()
gt; Application.Volatile
gt; MyStamp = FileDateTime(ThisWorkbook.FullName)
gt; End Function
gt;
gt; and use it in a cell as an UDF:
gt; = MyStamp()
gt;
gt; Works only after the active workbook has been saved as an .XLS file.
gt;
gt; Regards,
gt; Stefi
gt;
gt;
gt; ?avid L.??ezt ?rta:
gt;
gt; gt; I found the following code on Microsoft.com, which is what I think I need.
gt; gt;
gt; gt; 1. But how would I then reference this information in a cell?
gt; gt; 2. Also, how would I make this code generic so the filename would be
gt; gt; whatever the active file is?
gt; gt;
gt; gt; Thanks!
gt; gt;
gt; gt; Dim MyStamp
gt; gt; ' Assume TESTFILE was last modified on February 12, 1993
gt; gt; ' at 4:35:47 PM.
gt; gt; ' Assume English/U.S. locale settings.
gt; gt; MyStamp = FileDateTime(quot;TESTFILEquot;)
gt; gt; ' Returns quot;2/12/93 4:35:47 PMquot;.
gt; gt;
gt; gt;
gt; gt; quot;Stefiquot; wrote:
gt; gt;
gt; gt; gt; It's the FileDateTime VBA function you are looking for. You can create a
gt; gt; gt; simple UDF to reach time stamp on a worksheet.
gt; gt; gt;
gt; gt; gt; Regards,
gt; gt; gt; Stefi
gt; gt; gt;
gt; gt; gt;
gt; gt; gt;
gt; gt; gt; ?unc??ezt ?rta:
gt; gt; gt;
gt; gt; gt; gt; I want to return the File Property value of the excel file's last modified
gt; gt; gt; gt; date to a cell in a worksheet. Is this possible? I seem to recall that
gt; gt; gt; gt; there may be some way of using EXCEL4 macro, but cannot remember how. Or
gt; gt; gt; gt; perhaps there is an easier way.
gt; gt; gt; gt;
gt; gt; gt; gt; Many thanks

Did you save the function where Stefi said to put it, namely, a Module? In
the VB editor, click on Insert/Module in its menu bar and copy paste the
code in the code window that opens up. Now go back to the worksheet and hit
F9 to force an update.

--
Rick (MVP - Excel)quot;PSU35quot; gt; wrote in message
...
gt; Stefi
gt; I came across yor response below and tried it just as shown.
gt; Unfortunately
gt; it returns #NAME?.
gt; Do I need to add something?
gt; I assumed it would return the date without specifing the file name.
gt; Rick
gt;
gt; quot;Stefiquot; wrote:
gt;
gt;gt; Install this UDF in a normal module:
gt;gt; Function MyStamp()
gt;gt; Application.Volatile
gt;gt; MyStamp = FileDateTime(ThisWorkbook.FullName)
gt;gt; End Function
gt;gt;
gt;gt; and use it in a cell as an UDF:
gt;gt; = MyStamp()
gt;gt;
gt;gt; Works only after the active workbook has been saved as an .XLS file.
gt;gt;
gt;gt; Regards,
gt;gt; Stefi
gt;gt;
gt;gt;
gt;gt; ?avid L.??ezt ?rta:
gt;gt;
gt;gt; gt; I found the following code on Microsoft.com, which is what I think I
gt;gt; gt; need.
gt;gt; gt;
gt;gt; gt; 1. But how would I then reference this information in a cell?
gt;gt; gt; 2. Also, how would I make this code generic so the filename would be
gt;gt; gt; whatever the active file is?
gt;gt; gt;
gt;gt; gt; Thanks!
gt;gt; gt;
gt;gt; gt; Dim MyStamp
gt;gt; gt; ' Assume TESTFILE was last modified on February 12, 1993
gt;gt; gt; ' at 4:35:47 PM.
gt;gt; gt; ' Assume English/U.S. locale settings.
gt;gt; gt; MyStamp = FileDateTime(quot;TESTFILEquot;)
gt;gt; gt; ' Returns quot;2/12/93 4:35:47 PMquot;.
gt;gt; gt;
gt;gt; gt;
gt;gt; gt; quot;Stefiquot; wrote:
gt;gt; gt;
gt;gt; gt; gt; It's the FileDateTime VBA function you are looking for. You can
gt;gt; gt; gt; create a
gt;gt; gt; gt; simple UDF to reach time stamp on a worksheet.
gt;gt; gt; gt;
gt;gt; gt; gt; Regards,
gt;gt; gt; gt; Stefi
gt;gt; gt; gt;
gt;gt; gt; gt;
gt;gt; gt; gt;
gt;gt; gt; gt; ?unc??ezt ?rta:
gt;gt; gt; gt;
gt;gt; gt; gt; gt; I want to return the File Property value of the excel file's last
gt;gt; gt; gt; gt; modified
gt;gt; gt; gt; gt; date to a cell in a worksheet. Is this possible? I seem to recall
gt;gt; gt; gt; gt; that
gt;gt; gt; gt; gt; there may be some way of using EXCEL4 macro, but cannot remember
gt;gt; gt; gt; gt; how. Or
gt;gt; gt; gt; gt; perhaps there is an easier way.
gt;gt; gt; gt; gt;
gt;gt; gt; gt; gt; Many thanks

arrow
arrow
    全站熱搜
    創作者介紹
    創作者 software 的頭像
    software

    software

    software 發表在 痞客邦 留言(0) 人氣()