![]() |
![]() |
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
New Member
Join Date: May 2002
Location: Virginia Beach
Posts: 4
|
How can I store the Workbook file date in a cell?
|
|
|
|
|
|
#2 | |
|
MrExcel MVP
Join Date: Feb 2002
Location: Auckland, New Zealand
Posts: 4,209
|
Quote:
Which File Date ?? Date Created Date Modified Date Last accessed Note: Last accessed & last Modified will be the same if Open. All these are avail in the Workbooks Properties Files > Property > General Tab |
|
|
|
|
|
|
#3 |
|
MrExcel MVP
Join Date: Mar 2002
Location: Chicago, IL USA
Posts: 2,042
|
Hi,
Consider the VBA function FileDateTime and the BuiltinDocumentProperties property to return what you want. See VBA help for details. As Ivan noted, an open workbook has the same properties for a few of the items. Bye, Jay |
|
|
|
|
|
#4 |
|
New Member
Join Date: May 2002
Location: Virginia Beach
Posts: 4
|
The date the workbook was modified, not the date accessed.
Thanks, |
|
|
|
|
|
#5 |
|
Board Regular
Join Date: May 2002
Location: Tennessee, USA
Posts: 72
|
John,
You could use the code below :-> Function LastMod() '//Finds the File's last modified date/time '//...display depends on cell date/time format '//Use: =ROUNDDOWN(LastMod(),0) '//Returns: mm/dd/yy with minutes & seconds at zero '//...so exact no. of days since last mod can be calc. Dim Fso, F Set Fso = CreateObject("Scripting.FileSystemObject") Set F = Fso.GetFile("c:yourfilename.xls") LastMod = F.DateLastModified End Function ...then put =ROUNDDOWN(LastMod(),0) in the cell you want the last mod date to show up in. (I round down the date to get rid of the minutes & seconds for another calculation that I'm using). Good luck. Wayne |
|
|
|
|
|
#6 |
|
New Member
Join Date: May 2002
Location: Virginia Beach
Posts: 4
|
Looks like Excel 2000 may not be able to do what I wanted. I periodically deliver a Workbook database which reflects data downloaded from another computer (main frame). I include a manual date entry which relfects the date I last modified the workbook, i.e. the data contained herein is current through this date. Since Excel 2000 shows the modified date as the date the workbook is opended the modified date is effectively the same as Now() which does not reflect the date the workbook was last updated (i.e. changed).
|
|
|
|
|
|
#7 |
|
New Member
Join Date: May 2002
Location: Virginia Beach
Posts: 4
|
I got it to do what I needed by incorporating the function technique into a larger macro that I run when formatting the data in the workbook. Thanks so much to all and in particular to Wayne.
John Hensen |
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|