PC Review


Reply
Thread Tools Rate Thread

Comparing 2 files on date/time stamp, and based time difference do a subroutine

 
 
info@stevik.nl
Guest
Posts: n/a
 
      28th Sep 2007



Hello all,

I'm looking for a code which compares two given files. If the time
between the 2 files differ more than 10 minutes, a choise is given to
either open one file or the other.

such as:
N:\Shoes\Shoes.xls 2/14/2007 14:17
C:\Local\Shoes.xls 2/14/2007 16:22



It would be great if you could help me out here.
The code is needed in Excel-VBA 2002 SP2

Thanks! :-)

 
Reply With Quote
 
 
 
 
Robin Hammond
Guest
Posts: n/a
 
      28th Sep 2007
This should get you started. It shows how to get the file time using the
windows scripting file system object.

Option Explicit

Sub Main()
EnumerateFileTimes ("C:\")
End Sub

Public Sub EnumerateFileTimes(strFolderPath As String)
Dim fsO As Object
Dim fsFolder As Object
Dim fsSubFolders As Object
Dim fsSub As Object
Dim fsFiles As Object
Dim fsFile As Object

Set fsO = CreateObject("Scripting.FileSystemObject")
Set fsFolder = fsO.GetFolder(strFolderPath)
Set fsSubFolders = fsFolder.Subfolders

For Each fsSub In fsSubFolders

Set fsFiles = fsSub.Files

For Each fsFile In fsFiles

Debug.Print "Folder: " & fsSub.Name, _
"File: " & fsFile.Name, _
"Date: " & FormatDateTime(fsFile.DateLastModified, vbShortDate),
_
"Time: " & FormatDateTime(fsFile.DateLastModified, vbShortTime)

Next

Next

End Sub


--
Robin Hammond
www.enhanceddatasystems.com


<(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
>
>
>
> Hello all,
>
> I'm looking for a code which compares two given files. If the time
> between the 2 files differ more than 10 minutes, a choise is given to
> either open one file or the other.
>
> such as:
> N:\Shoes\Shoes.xls 2/14/2007 14:17
> C:\Local\Shoes.xls 2/14/2007 16:22
>
>
>
> It would be great if you could help me out here.
> The code is needed in Excel-VBA 2002 SP2
>
> Thanks! :-)
>



 
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
XP vs. Vista Movie Maker - time and date stamp difference? Dave the frustrated Vista user Windows XP MovieMaker 0 27th Jun 2008 11:15 PM
Difference between Windows Time Service and Internet Time in Date & Time Properties Saucer Man Windows XP General 0 14th Feb 2008 01:51 PM
Comparing Files with only Date Time Stamp Difference rm Microsoft VB .NET 2 31st Jul 2007 10:09 AM
How can I find records based upon a date and time range while accounting for time zone difference BJC Microsoft Access 2 11th Jul 2007 01:13 AM
Looking for prog to change date / time stamp on files please. whayface Freeware 6 10th Jan 2005 03:32 PM


Features
 

Advertising
 

Newsgroups
 


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