So I am new to VBA but I am decent with excel. Basically I have a macro that opens and copy->pastes data from 24 files into one Summary file. It works correctly, although I'm sure it is ugly . So in Column B I have the workbook names and in Column C I have a flag (Yes or No) to update the data from that workbook. Now what I am wanting to do is somehow capture the date modified of each of the files so I know if it is the most current data.
I cant think of a way for an excel formula to do the trick but I have found the following:
Place this code in the workbook code page:
Code:
Code:
Found here: http://www.mrexcel.com/forum/excel-...g-last-modified-date-cell-a1.html#post3228961
I also found:
Can someone help me encorporate this or any system into my macro?
Thanks!
I cant think of a way for an excel formula to do the trick but I have found the following:
Place this code in the workbook code page:
Code:
Code:
Option Explicit
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
ThisWorkbook.Sheets(1).Range("A1") = ReturnWhenModifiedDate
End Sub
Code:
Code:
Option Explicit
Function ReturnWhenModifiedDate() As Date
'Called by Workbook Before_Save event
Dim fso As Object, f As Object
If thisworkbook.Path = vbNullString Then
'File has never been saved
ReturnWhenModifiedDate = Now() 'Return current date/time
Else
'File saved previously return that time
Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso.GetFile(thisworkbook.Path & "\" & thisworkbook.Name)
ReturnWhenModifiedDate = f.DateLastModified
Set f = Nothing
Set fso = Nothing
End If
End Function
Found here: http://www.mrexcel.com/forum/excel-...g-last-modified-date-cell-a1.html#post3228961
I also found:
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
Can someone help me encorporate this or any system into my macro?
Thanks!