Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

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

Posted on 2014-02-18
4
Medium Priority
?
1,329 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Survive A High-Traffic Event with Percona

Your application or website rely on your database to deliver information about products and services to your customers. You can’t afford to have your database lose performance, lose availability or become unresponsive – even for just a few minutes.

Question has a verified solution.

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

Ever visit a website where you spotted a really cool looking Font, yet couldn't figure out which font family it belonged to, or how to get a copy of it for your own use? This article explains the process of doing exactly that, as well as showing how…
New style of hardware planning for Microsoft Exchange server.
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
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…

705 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