Solved

VB Excel 2013 Macro to determine the last time a file was saved

Posted on 2014-02-18
4
1,177 Views
Last Modified: 2014-02-24
I am looking for a macro that will determine the last time a file was saved.  In other words I a have a Workbook open and wish to have a macro run that will put the date and time that another workbook was last saved.  Also the user that saved it.
0
Comment
Question by:DavidH7470
  • 2
4 Comments
 
LVL 80

Expert Comment

by:byundt
Comment Utility
You access this information through the workbook's BuiltInDocumentProperties collection:
Sub LastSave()
Dim wb As Workbook
Set wb = ActiveWorkbook
MsgBox wb.BuiltinDocumentProperties("Last save time") & vbLf & _
        wb.BuiltinDocumentProperties("Last Author")
End Sub

Open in new window

0
 
LVL 80

Expert Comment

by:byundt
Comment Utility
I can never remember the names of the document properties, and so write code to list them out each time.
Sub ListDocumentProperties()
Dim pp As DocumentProperty
On Error Resume Next
For Each pp In ActiveWorkbook.BuiltinDocumentProperties
    Debug.Print pp.Name & " " & pp.Value
Next
For Each pp In ActiveWorkbook.CustomDocumentProperties
    Debug.Print pp.Name & " " & pp.Value
Next
End Sub

Open in new window

0
 
LVL 8

Expert Comment

by:TheNautican
Comment Utility
0
 
LVL 35

Accepted Solution

by:
[ fanpages ] earned 500 total points
Comment Utility
Hi,

In case I am the only "Expert" to notice you actually asked for "...the date and time that another workbook was last saved...", please substitute the fully-qualified (folder &) filename for "c:\folder\Filename.xls" within the code below (that displays a Message Box with the last modified date of the specified file):

MsgBox CreateObject("Scripting.FileSystemObject").GetFile("c:\folder\Filename.xls").DateLastModified

Open in new window


You also asked for
...the user that saved it.
.

Assuming the other workbook is closed when the information is required, you will need to open the other workbook, execute code similar to that already provided above to retrieve the last author of the workbook (if the personal information has not been removed at the point of the latest modification), & then the other workbook closed (again).

Is that feasible for your requirements?

BFN,

fp.
0

Featured Post

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

This collection of functions covers all the normal rounding methods of just about any numeric value.
In this article we discuss how to recover the missing Outlook 2011 for Mac data like Emails and Contacts manually.
The viewer will learn how to create a normally distributed random variable in Excel, use a normal distribution to simulate the return on an investment over a period of years, Create a Monte Carlo simulation using a normal random variable, and calcul…
This Micro Tutorial will demonstrate how to use a scrolling table in Microsoft Excel using the INDEX function.

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

6 Experts available now in Live!

Get 1:1 Help Now