Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

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

Posted on 2014-02-18
4
Medium Priority
?
1,372 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 81

Expert Comment

by:byundt
ID: 39868422
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 81

Expert Comment

by:byundt
ID: 39868436
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
ID: 39868437
0
 
LVL 35

Accepted Solution

by:
[ fanpages ] earned 2000 total points
ID: 39880623
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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Outlook for dependable use in a very small business   This article is about using the Outlook application (part of Microsoft Office) in a very small business, or for homeowners where dependability and reliability are critical requirements. This …
After seeing numerous questions for Dynamic Data Validation I notice that most have used Visual Basic to solve the problem. This suggestion is purely formula based and can be used in multiple rows.
This Micro Tutorial will demonstrate in Microsoft Excel how to add style and sexy appeal to horizontal bar charts.
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…

971 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