esfaryn
11-08-2005, 11:06 PM
From what i understand about File Search, the program will pick out the file name that contains the word/phase. However, what if all the files contain the same word/phase?
An example of different file names:
(1) "happy_work_009"
(2) "happy_tuesday_work_001"
(3) "happy_monday_work_001"
(4) "wednesday_work_005"
So basically, I want to retrieve all files that contains just the word "happy"? How do i search for a file in a directory?
And also, how do i condition the file search not to go thru the files whose size are 0kb and also to retrieve file from a period of time using msoConditionAnytimeBetween property??
Im using the vba to write the codings out. need urgent help please?
coding:
fs = application.filesearch
fs.newsearch
fs.lookin = directory
fs.filename = variable & "??????????????.dat"
With fs.PropertyTests
.Add Name:="Last Modified", Condition:=msoConditionAnytimeBetween, _
Value:=Format(dt1, "dd MMM yyyy"), _
SecondValue:=Format(dt2, "dd MMM yyyy")
' .Add name:="File Name", Condition:=msoConditionIsExactly, _
' Value:=variable & "??????????????*.dat"
' .Add name:="File Name", Condition:=msoConditionEquals, _
' Value:=variable & "??????????????*.dat"
end with
fs.execute
the ones marked bold are the ones causing the error. invalid argument or procedure call.
An example of different file names:
(1) "happy_work_009"
(2) "happy_tuesday_work_001"
(3) "happy_monday_work_001"
(4) "wednesday_work_005"
So basically, I want to retrieve all files that contains just the word "happy"? How do i search for a file in a directory?
And also, how do i condition the file search not to go thru the files whose size are 0kb and also to retrieve file from a period of time using msoConditionAnytimeBetween property??
Im using the vba to write the codings out. need urgent help please?
coding:
fs = application.filesearch
fs.newsearch
fs.lookin = directory
fs.filename = variable & "??????????????.dat"
With fs.PropertyTests
.Add Name:="Last Modified", Condition:=msoConditionAnytimeBetween, _
Value:=Format(dt1, "dd MMM yyyy"), _
SecondValue:=Format(dt2, "dd MMM yyyy")
' .Add name:="File Name", Condition:=msoConditionIsExactly, _
' Value:=variable & "??????????????*.dat"
' .Add name:="File Name", Condition:=msoConditionEquals, _
' Value:=variable & "??????????????*.dat"
end with
fs.execute
the ones marked bold are the ones causing the error. invalid argument or procedure call.