|
-
Jun 4th, 2009, 12:01 PM
#1
[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.
-
Jun 4th, 2009, 12:22 PM
#2
Fanatic Member
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
-
Jun 4th, 2009, 12:49 PM
#3
Re: Excel VBA - Show Last Saved/Modified Date
BuiltinDocumentProperties - 
Didn't see that comin' 
Thank you sir!
-
Jun 4th, 2009, 12:53 PM
#4
Fanatic Member
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.
-
Aug 6th, 2012, 06:28 AM
#5
New Member
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|