ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   FileSearch worked in Excel 97 but not in Excel 2003, how to fix??? (https://www.excelbanter.com/excel-programming/409765-filesearch-worked-excel-97-but-not-excel-2003-how-fix.html)

August 8

FileSearch worked in Excel 97 but not in Excel 2003, how to fix???
 
The following code worked in Excel 97 but not worked in Excel 2003, why why
why???
and how to fix??? Thanks!!!

Sub test()

With Application.FileSearch
.NewSearch
.SearchSubFolders = True
.filename = "S:\list_file.xls"
.MatchTextExactly = True
If .Execute() 0 Then
MsgBox "found"
Else
MsgBox "not found"
End If
End With

End Sub



Zack Barresse

FileSearch worked in Excel 97 but not in Excel 2003, how to fix???
 
It does work in 2003, but does not in 2007. Your variable ...

..filename = "S:\list_file.xls"

.... should be ...

..Filename = "list_file.xls"
..LookIn = "S:\"

HTH

--
Zack Barresse




"August 8" wrote in message
...
The following code worked in Excel 97 but not worked in Excel 2003, why
why
why???
and how to fix??? Thanks!!!

Sub test()

With Application.FileSearch
.NewSearch
.SearchSubFolders = True
.filename = "S:\list_file.xls"
.MatchTextExactly = True
If .Execute() 0 Then
MsgBox "found"
Else
MsgBox "not found"
End If
End With

End Sub




August 8

FileSearch worked in Excel 97 but not in Excel 2003, how to fi
 
Thanks.

It runs without error in 2003 but give me wrong result:
the file does not exist!!
(The same code run in 97 without any error and give me correct result!)

If I use .LookIn
it give me "compile error: Invalid use of property"...


"Zack Barresse" wrote:

It does work in 2003, but does not in 2007. Your variable ...

.filename = "S:\list_file.xls"

... should be ...

.Filename = "list_file.xls"
.LookIn = "S:\"

HTH

--
Zack Barresse




"August 8" wrote in message
...
The following code worked in Excel 97 but not worked in Excel 2003, why
why
why???
and how to fix??? Thanks!!!

Sub test()

With Application.FileSearch
.NewSearch
.SearchSubFolders = True
.filename = "S:\list_file.xls"
.MatchTextExactly = True
If .Execute() 0 Then
MsgBox "found"
Else
MsgBox "not found"
End If
End With

End Sub




August 8

FileSearch worked in Excel 97 but not in Excel 2003, how to fi
 
Sorry, my mistake, forgot the "=" after ".LookIn"
but why I have to use ".LookIn"?

Thanks!

"August 8" wrote:

Thanks.

It runs without error in 2003 but give me wrong result:
the file does not exist!!
(The same code run in 97 without any error and give me correct result!)

If I use .LookIn
it give me "compile error: Invalid use of property"...


"Zack Barresse" wrote:

It does work in 2003, but does not in 2007. Your variable ...

.filename = "S:\list_file.xls"

... should be ...

.Filename = "list_file.xls"
.LookIn = "S:\"

HTH

--
Zack Barresse




"August 8" wrote in message
...
The following code worked in Excel 97 but not worked in Excel 2003, why
why
why???
and how to fix??? Thanks!!!

Sub test()

With Application.FileSearch
.NewSearch
.SearchSubFolders = True
.filename = "S:\list_file.xls"
.MatchTextExactly = True
If .Execute() 0 Then
MsgBox "found"
Else
MsgBox "not found"
End If
End With

End Sub




Zack Barresse

FileSearch worked in Excel 97 but not in Excel 2003, how to fi
 
You don't have to use the LookIn property. It's been a while since I used
the FileSearch method (mostly because I'm predominantly 2007 now) but if you
didn't specify where to look you may be off in la-la land looking for the
file(s).

--
Zack Barresse



"August 8" wrote in message
...
Sorry, my mistake, forgot the "=" after ".LookIn"
but why I have to use ".LookIn"?

Thanks!

"August 8" wrote:

Thanks.

It runs without error in 2003 but give me wrong result:
the file does not exist!!
(The same code run in 97 without any error and give me correct result!)

If I use .LookIn
it give me "compile error: Invalid use of property"...


"Zack Barresse" wrote:

It does work in 2003, but does not in 2007. Your variable ...

.filename = "S:\list_file.xls"

... should be ...

.Filename = "list_file.xls"
.LookIn = "S:\"

HTH

--
Zack Barresse




"August 8" wrote in message
...
The following code worked in Excel 97 but not worked in Excel 2003,
why
why
why???
and how to fix??? Thanks!!!

Sub test()

With Application.FileSearch
.NewSearch
.SearchSubFolders = True
.filename = "S:\list_file.xls"
.MatchTextExactly = True
If .Execute() 0 Then
MsgBox "found"
Else
MsgBox "not found"
End If
End With

End Sub






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

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com