Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Comparing date modified between two files
How can I find the date modified of an external file in Excel with a
macro? I am trying to merge only worksheets from files that are not already in the current worksheet. Any ideas how to do this? thanks in advance! |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Comparing date modified between two files
s = "C:\Myfolder\MySheet.xls"
dt = filedatetime(s) -- Regards, Tom Ogilvy "Koveras" wrote: How can I find the date modified of an external file in Excel with a macro? I am trying to merge only worksheets from files that are not already in the current worksheet. Any ideas how to do this? thanks in advance! |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Comparing date modified between two files
How would I use this with a For Next Loop for all files in a folder?
Would I need to use BuiltinDocumentProperties("last save time") like for example: If TargetWkbk.BuiltinDocumentProperties("last save time") ActiveWorkbook.BuiltinDocumentProperties("last save time") Then and put the For Next loop in here? I dont have a lot of VB knowledge and this is confusing me. Thanks for your help Tom Ogilvy wrote: s = "C:\Myfolder\MySheet.xls" dt = filedatetime(s) -- Regards, Tom Ogilvy "Koveras" wrote: How can I find the date modified of an external file in Excel with a macro? I am trying to merge only worksheets from files that are not already in the current worksheet. Any ideas how to do this? thanks in advance! |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Comparing date modified between two files
Sub ABC()
Dim rw as Long, sPath as String Dim sName as string rw = 2 sPath = "C:\Myfolder\" sName = Dir(sPath & "*.xls") do while sName < "" cells(rw,1).Value = sName cells(rw,2).Value = FileDateTime(sPath & sName) rw = rw + 1 Loop End Sub just for illustration: from the immediate window: ? filedatetime("E:\Data\KZ081-Default Survey1.xls") 3/17/2002 5:51:20 PM -- Regards, Tom Ogilvy "Koveras" wrote in message ups.com... How would I use this with a For Next Loop for all files in a folder? Would I need to use BuiltinDocumentProperties("last save time") like for example: If TargetWkbk.BuiltinDocumentProperties("last save time") ActiveWorkbook.BuiltinDocumentProperties("last save time") Then and put the For Next loop in here? I dont have a lot of VB knowledge and this is confusing me. Thanks for your help Tom Ogilvy wrote: s = "C:\Myfolder\MySheet.xls" dt = filedatetime(s) -- Regards, Tom Ogilvy "Koveras" wrote: How can I find the date modified of an external file in Excel with a macro? I am trying to merge only worksheets from files that are not already in the current worksheet. Any ideas how to do this? thanks in advance! |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Comparing date modified between two files
This is excellent. I can definitely use this except it causes an
endless loop and only obtains the first file and writes it in all 65536 rows before crashing. What do I need to add to resolve this? Thanks so much for the help! Tom Ogilvy wrote: Sub ABC() Dim rw as Long, sPath as String Dim sName as string rw = 2 sPath = "C:\Myfolder\" sName = Dir(sPath & "*.xls") do while sName < "" cells(rw,1).Value = sName cells(rw,2).Value = FileDateTime(sPath & sName) rw = rw + 1 Loop End Sub just for illustration: from the immediate window: ? filedatetime("E:\Data\KZ081-Default Survey1.xls") 3/17/2002 5:51:20 PM -- Regards, Tom Ogilvy "Koveras" wrote in message ups.com... How would I use this with a For Next Loop for all files in a folder? Would I need to use BuiltinDocumentProperties("last save time") like for example: If TargetWkbk.BuiltinDocumentProperties("last save time") ActiveWorkbook.BuiltinDocumentProperties("last save time") Then and put the For Next loop in here? I dont have a lot of VB knowledge and this is confusing me. Thanks for your help Tom Ogilvy wrote: s = "C:\Myfolder\MySheet.xls" dt = filedatetime(s) -- Regards, Tom Ogilvy "Koveras" wrote: How can I find the date modified of an external file in Excel with a macro? I am trying to merge only worksheets from files that are not already in the current worksheet. Any ideas how to do this? thanks in advance! |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
Comparing date modified between two files
Left out a critical line of code:
Sub ABC() Dim rw as Long, sPath as String Dim sName as string rw = 2 sPath = "C:\Myfolder\" sName = Dir(sPath & "*.xls") do while sName < "" cells(rw,1).Value = sName cells(rw,2).Value = FileDateTime(sPath & sName) rw = rw + 1 sName = Dir() Loop End Sub My apologies. -- Regards, Tom Ogilvy "Koveras" wrote in message oups.com... This is excellent. I can definitely use this except it causes an endless loop and only obtains the first file and writes it in all 65536 rows before crashing. What do I need to add to resolve this? Thanks so much for the help! Tom Ogilvy wrote: Sub ABC() Dim rw as Long, sPath as String Dim sName as string rw = 2 sPath = "C:\Myfolder\" sName = Dir(sPath & "*.xls") do while sName < "" cells(rw,1).Value = sName cells(rw,2).Value = FileDateTime(sPath & sName) rw = rw + 1 Loop End Sub just for illustration: from the immediate window: ? filedatetime("E:\Data\KZ081-Default Survey1.xls") 3/17/2002 5:51:20 PM -- Regards, Tom Ogilvy "Koveras" wrote in message ups.com... How would I use this with a For Next Loop for all files in a folder? Would I need to use BuiltinDocumentProperties("last save time") like for example: If TargetWkbk.BuiltinDocumentProperties("last save time") ActiveWorkbook.BuiltinDocumentProperties("last save time") Then and put the For Next loop in here? I dont have a lot of VB knowledge and this is confusing me. Thanks for your help Tom Ogilvy wrote: s = "C:\Myfolder\MySheet.xls" dt = filedatetime(s) -- Regards, Tom Ogilvy "Koveras" wrote: How can I find the date modified of an external file in Excel with a macro? I am trying to merge only worksheets from files that are not already in the current worksheet. Any ideas how to do this? thanks in advance! |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Modified files | Excel Discussion (Misc queries) | |||
modified date | Excel Programming | |||
my excel files being modified by a virus | Excel Discussion (Misc queries) | |||
can it be modified to filter & list *.xls files only? | Excel Programming |