PC Review


Reply
Thread Tools Rate Thread

access file based on last saved date/time

 
 
=?Utf-8?B?U3RldmVEQjE=?=
Guest
Posts: n/a
 
      17th Aug 2007
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 With Quote
 
 
 
 
=?Utf-8?B?Sm9lbA==?=
Guest
Posts: n/a
 
      18th Aug 2007
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 With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Excel should have a function for last date and time file was saved =?Utf-8?B?ZndidWNrbGV5?= Microsoft Excel Worksheet Functions 11 15th Aug 2007 11:04 PM
File Date/Time Information in Access Field =?Utf-8?B?Ry1NYW4=?= Microsoft Access Forms 1 26th Jul 2007 02:46 PM
ACCESS IMPORT DATE/TIME IN CSV FILE =?Utf-8?B?cnlkZW4=?= Microsoft Access Getting Started 2 9th Jan 2006 10:30 PM
Update a formula based on date worksheet was saved =?Utf-8?B?S2V2aW4gTWNRdWFpbg==?= Microsoft Excel Worksheet Functions 0 6th Oct 2005 02:06 PM
Date & Time file was last saved M.Siler Microsoft Excel Misc 1 4th Jun 2004 11:08 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 07:02 PM.