Results 1 to 5 of 5

Thread: [RESOLVED] Excel VBA - Show Last Saved/Modified Date

  1. #1

    Thread Starter
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Resolved [RESOLVED] Excel VBA - Show Last Saved/Modified Date

    I need to display the date and time a spreadsheet was last saved each time the sheet is opened. I use the following function and incorporate it as shown
    Code:
    Public Function myDate()
      myDate = Format(FileDateTime(Application.ActiveWorkbook.FullName), "mm/dd/yyyy h:n ampm")
    End Function
    
    Private Sub Workbook_Open()
    Sheet1.Range("D38") = myDate
    End Sub
    The problem is that when the file is opened is displayes the current date and time not the last time the file was saved.

    How would I fix this?

    I've done a fair amount of Googling about as well as looking through the Excel VBA code here on VBF and the general consensus seems to be that using FileDateTime is the way to go....but it doesn't want to play the way Uncle Hack needs it to play.

  2. #2
    Fanatic Member BillBoeBaggins's Avatar
    Join Date
    Jan 2003
    Location
    in your database, dropping your tables.
    Posts
    628

    Re: Excel VBA - Show Last Saved/Modified Date

    Code:
    ?excel.Application.ThisWorkbook.BuiltinDocumentProperties.count
     30 
    ?excel.Application.ThisWorkbook.BuiltinDocumentProperties("Last Author")
    Sutter Connect
    ?excel.Application.ThisWorkbook.BuiltinDocumentProperties("Creation Date")
    10/14/1996 4:33:28 PM 
    ?excel.Application.ThisWorkbook.BuiltinDocumentProperties("Last Save Time")
    11/29/2005 1:10:27 PM
    http://msdn.microsoft.com/en-us/libr...es(VS.80).aspx

  3. #3

    Thread Starter
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: Excel VBA - Show Last Saved/Modified Date

    BuiltinDocumentProperties -

    Didn't see that comin'

    Thank you sir!

  4. #4
    Fanatic Member BillBoeBaggins's Avatar
    Join Date
    Jan 2003
    Location
    in your database, dropping your tables.
    Posts
    628

    Re: [RESOLVED] Excel VBA - Show Last Saved/Modified Date

    I was thinking there HAS to be something in the Excel Properties with this so I just started cycling through the properties and hit gold with BuiltInDocumentProperties. heh.

  5. #5
    New Member
    Join Date
    Aug 2012
    Location
    Gold Coast, Australia
    Posts
    1

    Re: Excel VBA - Show Last Saved/Modified Date

    Hi 'Hack'. Can you show me how BillBooe's code fits into your suggested code, assuming that it does. As you probably can tell, I am a bit of a novice with VB and coding. Like you, I want the last saved date to remain 'intact' upon next opening.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width