ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Display external data inside of an Excel 2007 Spread sheet (https://www.excelbanter.com/excel-worksheet-functions/166068-display-external-data-inside-excel-2007-spread-sheet.html)

jingles457

Display external data inside of an Excel 2007 Spread sheet
 
How can I get Excel 2007 to display the "Date Modified" field of the
worksheet being opened?

ilia

Display external data inside of an Excel 2007 Spread sheet
 
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.

On Nov 14, 1:35 pm, jingles457
wrote:
How can I get Excel 2007 to display the "Date Modified" field of the
worksheet being opened?




jingles457

Display external data inside of an Excel 2007 Spread sheet
 
Thank you

"ilia" wrote:

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.

On Nov 14, 1:35 pm, jingles457
wrote:
How can I get Excel 2007 to display the "Date Modified" field of the
worksheet being opened?






All times are GMT +1. The time now is 06:48 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com