Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 414
Default access file based on last saved date/time

Hello folks.
I'm trying to develop a multi-stage macro that will access a group of files,
and look at the last saved date. If that date is more recent than the file
the macro is calling from, I want to open, and then copy a portion of the
second file into the first.
We've purchased the WROX Excel 2007 VBA programmer's reference manual, but
I'm not able to readily identify the information I'm seeking to accomplish
the above.

So, at this point, I want to accomplish the following:
1- have the code to look at the save date in the properties of fileB.
2- if that date is more recent than the last save date of fileA, open fileB.

does anoyone know where I can look in the programmer's reference book to
learn more on how to perform this?
Or, how to do this?
Thank you.
Best.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default access file based on last saved date/time

Sub ShowFolderInfo()
Dim fs, myfolder, myfiles

Const MyPath = "c:\temp"



Set fs = CreateObject("Scripting.FileSystemObject")

Filename = UCase(ThisWorkbook.Name)
If Right(Filename, 3) < "XLS" Then
MsgBox ("File does not exist because Wrokbook was not saved")
End If

Set ThisFile = fs.getfile(ThisWorkbook.Name)
Thisdate = ThisFile.datelastmodified

Set myfolder = fs.GetFolder(MyPath)


For Each Filename In myfolder.Files
If UCase(Right(Filename.Name, 3)) = "XLS" Then

datemodified = Filename.datelastmodified

If datemodified Thisdate Then
'enter your code here
End If
End If
Next Filename

End Sub


"SteveDB1" wrote:

Hello folks.
I'm trying to develop a multi-stage macro that will access a group of files,
and look at the last saved date. If that date is more recent than the file
the macro is calling from, I want to open, and then copy a portion of the
second file into the first.
We've purchased the WROX Excel 2007 VBA programmer's reference manual, but
I'm not able to readily identify the information I'm seeking to accomplish
the above.

So, at this point, I want to accomplish the following:
1- have the code to look at the save date in the properties of fileB.
2- if that date is more recent than the last save date of fileA, open fileB.

does anoyone know where I can look in the programmer's reference book to
learn more on how to perform this?
Or, how to do this?
Thank you.
Best.

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
Excel should have a function for last date and time file was saved fwbuckley Excel Worksheet Functions 11 August 15th 07 11:04 PM
Can I access the previous version of a saved file? JCC Excel Discussion (Misc queries) 10 November 21st 05 08:24 PM
Update a formula based on date worksheet was saved Kevin McQuain Excel Worksheet Functions 0 October 6th 05 02:06 PM
Last Saved Date and Time Kim Excel Programming 8 August 15th 05 09:07 AM
How to have:= NOW () date/time change only if updated and saved Bob Provis Excel Worksheet Functions 2 August 7th 05 10:47 AM


All times are GMT +1. The time now is 09:43 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"