Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
BTW BTW is offline
external usenet poster
 
Posts: 5
Default Filesearch by last modified time...

Hi there,

I have a macro with the following code in the

It is searching for the last modified file between now, and 3 quarters
back. But, Excel returns an error...

this is my code:

GetDate = Now
GetDate2 = GetDate - 0.03

With Application.FileSearch

.LookIn = TSV_File_Path
.Filename = "*.tsv"
.PropertyTests.Add Name:="LastModified", _ (***Here is
generates an error***)
Condition:=msoConditionAnytimeBetween, _
Value:=GetDate2, _
SecondValue:=GetDate, _
Connector:=msoConnectorOr
.Execute

If .FoundFiles.Count < 0 Then

For i = 1 To .FoundFiles.Count
FoundedFilename = .FoundFiles(i)
Next i
Workbooks.OpenText Filename:=FoundedFilename
Excel_TSV_file = Application.ActiveWorkbook.Name

Else

MsgBox " No files found", vbOKOnly

End If

End With


Why doens't it work? can somebody help me out?

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 163
Default Filesearch by last modified time...

Hi,

I never used that, but help says it is not
"LastModified"
but
"Last Modified"

--
Greetings from Bavaria, Germany

Helmut Weber

Win XP, Office 2003
"red.sys" & Chr$(64) & "t-online.de"
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 318
Default Filesearch by last modified time...

Hi BTW,
Tried your code. Works fine for me. What is the exact error that you get?

"BTW" wrote:

Hi there,

I have a macro with the following code in the

It is searching for the last modified file between now, and 3 quarters
back. But, Excel returns an error...

this is my code:

GetDate = Now
GetDate2 = GetDate - 0.03

With Application.FileSearch

.LookIn = TSV_File_Path
.Filename = "*.tsv"
.PropertyTests.Add Name:="LastModified", _ (***Here is
generates an error***)
Condition:=msoConditionAnytimeBetween, _
Value:=GetDate2, _
SecondValue:=GetDate, _
Connector:=msoConnectorOr
.Execute

If .FoundFiles.Count < 0 Then

For i = 1 To .FoundFiles.Count
FoundedFilename = .FoundFiles(i)
Next i
Workbooks.OpenText Filename:=FoundedFilename
Excel_TSV_file = Application.ActiveWorkbook.Name

Else

MsgBox " No files found", vbOKOnly

End If

End With


Why doens't it work? can somebody help me out?


  #4   Report Post  
Posted to microsoft.public.excel.programming
BTW BTW is offline
external usenet poster
 
Posts: 5
Default Filesearch by last modified time...


Hi Alok

the error code I get is error code 5:

"invalid procedure call or argument"

Strange it works at your pc!

BTW

  #5   Report Post  
Posted to microsoft.public.excel.programming
BTW BTW is offline
external usenet poster
 
Posts: 5
Default Filesearch by last modified time...

O, and when I put a watch on Value and value2, it says that the value
is not defined in the expression...so did i write down the "getdate"
values on a wrong way?

BTW

BTW schreef:

Hi Alok

the error code I get is error code 5:

"invalid procedure call or argument"

Strange it works at your pc!

BTW




  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 318
Default Filesearch by last modified time...

You may want to Dim the GetDate and GetDate2 as Date
Dim GetDate as Date
Dim GetDate2 as Date
This is just a shot in the dark..

"BTW" wrote:

O, and when I put a watch on Value and value2, it says that the value
is not defined in the expression...so did i write down the "getdate"
values on a wrong way?

BTW

BTW schreef:

Hi Alok

the error code I get is error code 5:

"invalid procedure call or argument"

Strange it works at your pc!

BTW



  #7   Report Post  
Posted to microsoft.public.excel.programming
BTW BTW is offline
external usenet poster
 
Posts: 5
Default Filesearch by last modified time...


Alok schreef:

You may want to Dim the GetDate and GetDate2 as Date
Dim GetDate as Date
Dim GetDate2 as Date
This is just a shot in the dark..



i did do that...does somebody have an example that finds files by last
modfied time in minutes?

  #8   Report Post  
Posted to microsoft.public.excel.programming
BTW BTW is offline
external usenet poster
 
Posts: 5
Default Filesearch by last modified time...

I solved the problem.

it is about how the date is formatted. In my case it was formatted as
2006-11-28, but it should be 28/11/06....If it doens't work, it
crashes.

thanks for the attention.


BTW schreef:

Alok schreef:

You may want to Dim the GetDate and GetDate2 as Date
Dim GetDate as Date
Dim GetDate2 as Date
This is just a shot in the dark..



i did do that...does somebody have an example that finds files by last
modfied time in minutes?


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
Modified IF formula for military time kmariab Excel Worksheet Functions 3 April 13th 08 05:37 PM
Show date last time modified José Manuel Soberón Excel Programming 4 April 13th 06 10:00 AM
Last time modified timestamp Mikus Excel Programming 5 September 23rd 05 07:30 AM
Time Date Last Modified LDL Excel Discussion (Misc queries) 3 May 3rd 05 10:20 PM
modified time of a worksheet Gary Adamson[_2_] Excel Programming 1 August 26th 04 10:42 PM


All times are GMT +1. The time now is 09:45 AM.

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

About Us

"It's about Microsoft Excel"