Date and time a file was last saved

plwhittington

Board Regular
Joined
May 10, 2007
Messages
132
I have two excel files that are open. File #1 has macros and gets data from file #2. The path of the files may change, but they will always be open when the macro is executed. Also, File #2 is an extract from another system.

I would like for the macro to be able to return the date and time file #2 was last updated/saved in a message box. Any suggestions on how to return the date and time stamp would be appreciated.
 
Last edited:

Excel Facts

Move date out one month or year
Use =EDATE(A2,1) for one month later. Use EDATE(A2,12) for one year later.
I don't know how you have wb#2 referenced, but you could try built in properties:
Rich (BB code):
Sub exa3()
    MsgBox ThisWorkBook.BuiltinDocumentProperties(12)
End Sub
 
Upvote 0
that returns the date and time for File #1, which is running the macro, but even after having the code select file #2, it still returns date and time for file #1.

Windows("File2.xls").Activate
MsgBox ThisWorkbook.BuiltinDocumentProperties(12)

The code above is in a macro in File1.
 
Upvote 0
'ThisWorkbook' is the default name for the workbook the code is in. To refer to the other wb, something like:
Code:
MsgBox Workbooks("File2.xls").BuiltinDocumentProperties(12)
 
Upvote 0

Forum statistics

Threads
1,224,392
Messages
6,178,322
Members
452,841
Latest member
GenAkaman

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top