Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 202
Default How do I extract the last update date from a different excel file?

I need to place the last update date of a data file that I use to extract
data to a different file. I need the formula to place this date in a cell at
the top of my working file. Thanks
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default How do I extract the last update date from a different excel file?

Here is the general idea:

Sub NeedADate()
Dim FSO As Scripting.FileSystemObject
Dim FileItem As Scripting.File
Set FSO = New Scripting.FileSystemObject
filespec = "C:\test\tulip.jpg"
Set FileItem = FSO.GetFile(filespec)
MsgBox (FileItem.DateLastModified)
End Sub

You must include a reference to Microsoft Scripting Runtime

You would use your real data file in place of the .jpg
and
to store the date, something like:

Range("A1").Value=FileItem.DateLastModified
--
Gary''s Student - gsnu200828


"Dennis" wrote:

I need to place the last update date of a data file that I use to extract
data to a different file. I need the formula to place this date in a cell at
the top of my working file. Thanks

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,934
Default How do I extract the last update date from a different excel file?

You can use VB's FileTimeDate function to do that directly (without needing
any additional references)...

MsgBox FileDateTime("C:\test\tulip.jpg")

--
Rick (MVP - Excel)


"Gary''s Student" wrote in message
...
Here is the general idea:

Sub NeedADate()
Dim FSO As Scripting.FileSystemObject
Dim FileItem As Scripting.File
Set FSO = New Scripting.FileSystemObject
filespec = "C:\test\tulip.jpg"
Set FileItem = FSO.GetFile(filespec)
MsgBox (FileItem.DateLastModified)
End Sub

You must include a reference to Microsoft Scripting Runtime

You would use your real data file in place of the .jpg
and
to store the date, something like:

Range("A1").Value=FileItem.DateLastModified
--
Gary''s Student - gsnu200828


"Dennis" wrote:

I need to place the last update date of a data file that I use to extract
data to a different file. I need the formula to place this date in a cell
at
the top of my working file. Thanks


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
want to record date for each time I update a file - Excel 2007 PattyR Excel Discussion (Misc queries) 2 June 3rd 09 08:18 PM
want to record date for each time I update a file PattyR Excel Discussion (Misc queries) 2 May 27th 09 05:40 AM
i want to update one excel file the other one update automaticaly Basant New Users to Excel 1 December 16th 06 12:50 AM
How to prevent file date change when no update made in Excel? John2348 Excel Discussion (Misc queries) 0 June 16th 06 04:27 PM
Date last update for the file Chetoos Excel Discussion (Misc queries) 1 August 25th 05 11:16 AM


All times are GMT +1. The time now is 03:00 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"