Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Comparing 2 files on date/time stamp, and based time difference do a subroutine




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! :-)

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 45
Default Comparing 2 files on date/time stamp, and based time difference do a subroutine

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


wrote in message
ups.com...



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
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
Time date stamp naslami Excel Worksheet Functions 0 October 6th 09 03:11 AM
Date-time stamp Daniel Excel Discussion (Misc queries) 3 September 7th 09 10:58 AM
time stamp based on action in column. J.W. Aldridge Excel Programming 9 January 11th 07 12:53 AM
Date time stamp Frank Kabel Excel Programming 3 March 1st 04 08:56 PM
Date time stamp Chip Pearson Excel Programming 0 March 1st 04 04:14 PM


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

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

About Us

"It's about Microsoft Excel"