Display external data inside of an Excel 2007 Spread sheet

J

jingles457

How can I get Excel 2007 to display the "Date Modified" field of the
worksheet being opened?
 
I

ilia

Put the following code in the ThisWorkbook module:

Private Sub Workbook_Open()
Dim objFile As Object
Dim objShell As Object
Dim objFolder As Object

Set objShell = CreateObject("Shell.Application")

Set objFolder = objShell.Namespace(ThisWorkbook.Path)

For Each objFile In objFolder.items
Debug.Print objFolder.getdetailsof(objFile, 0)
If objFolder.getdetailsof(objFile, 0) = _
ThisWorkbook.Name Then Exit For
Next objFile
Call MsgBox("Last date modified: " & _
objFolder.getdetailsof(objFile, 3))
End Sub

Save in a macro-enabled file format, enable macros, save and reopen.
 
J

jingles457

Thank you

ilia said:
Put the following code in the ThisWorkbook module:

Private Sub Workbook_Open()
Dim objFile As Object
Dim objShell As Object
Dim objFolder As Object

Set objShell = CreateObject("Shell.Application")

Set objFolder = objShell.Namespace(ThisWorkbook.Path)

For Each objFile In objFolder.items
Debug.Print objFolder.getdetailsof(objFile, 0)
If objFolder.getdetailsof(objFile, 0) = _
ThisWorkbook.Name Then Exit For
Next objFile
Call MsgBox("Last date modified: " & _
objFolder.getdetailsof(objFile, 3))
End Sub

Save in a macro-enabled file format, enable macros, save and reopen.
 
Top