Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Workbook SAVED date? 1

Status
Not open for further replies.

N1GHTEYES

Technical User
Jun 18, 2004
771
GB
Is there a way of finding out when an open Excel workbook (actually an Add_In in this case) was last saved?

I'm trying to check the saved date of the add-in when it opens and compare it with the date in a text file. If the book date is newer, I run some other code, if not I don't.

As far as I can see, the workbook object does not have a property equivalent to "DateLastSaved". So I tried to use the filesystem to get a file object and look at its DateLastModified property.

Unfortunately, this always seems to give me the time the file was last opened, which, given that this code is running in the file after it opens, is always more recent than the date in the text file. DateLastAccessed gives the same result. DateCreated does give me an earlier date, but it does not seem to get updated if the file is saved.

So the question boils down to - Is there a way of finding out the REAL date when a workbook (specifically an Add-In) was actually last SAVED?

Tony
 



Hi,

Try this...
Code:
    Dim wb As Workbook
    For Each wb In Workbooks
        MsgBox wb.Name & ":" & wb.BuiltinDocumentProperties("Last Save Time")
    Next

Skip,

[glasses] When a diminutive clarvoyant had disappeared from detention, headlines read...
Small Medium at Large[tongue]
 
Thanks Skip - a perfect solution. Have a star.

Is it just my imagination, or do they go out of their way to avoid advertising that feature? I searched for ages trying to find a way of doing that.

Now I need to go and have a play and find out what other goodies BuiltinDocumentProperties holds...

Tony
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top