Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Time date stamp | Excel Worksheet Functions | |||
Date-time stamp | Excel Discussion (Misc queries) | |||
time stamp based on action in column. | Excel Programming | |||
Date time stamp | Excel Programming | |||
Date time stamp | Excel Programming |