Filesearch by last modified time...

B

BTW

Hi there,

I have a macro with the following code in there:

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?
 
H

Helmut Weber

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"
 
B

BTW

Hi Alok

the error code I get is error code 5:

"invalid procedure call or argument"

Strange it works at your pc!

BTW
 
B

BTW

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:
 
G

Guest

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..
 
B

BTW

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?
 
B

BTW

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:
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top