ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Application.Filesearch (https://www.excelbanter.com/excel-programming/370562-application-filesearch.html)

EA

Application.Filesearch
 
Can anyone please advise why the code below worked with Excel 2000 but not
with Excel 2003?

With Application.FileSearch
.Filename = "C:\Test.xls"
If .Execute 0 Then
Workbooks.Open Filename:="C:\Text.xls"
End If
End With



NickHK[_3_]

Application.Filesearch
 
FileSearch seems so flakey that it best avoided.
Use Dir or better GetAttr to determine if the file exists.

NickHK

"EA" ...
Can anyone please advise why the code below worked with Excel 2000 but not
with Excel 2003?

With Application.FileSearch
.Filename = "C:\Test.xls"
If .Execute 0 Then
Workbooks.Open Filename:="C:\Text.xls"
End If
End With





EA

Application.Filesearch
 
I always use DIR myself, but an inexperienced programmer asked me the
question below and I had not answer for him, especially when he
demonstrated.

I was hoping one of the MVPs would offer some input.


"NickHK" wrote in message
...
FileSearch seems so flakey that it best avoided.
Use Dir or better GetAttr to determine if the file exists.

NickHK

"EA"
...
Can anyone please advise why the code below worked with Excel 2000 but
not with Excel 2003?

With Application.FileSearch
.Filename = "C:\Test.xls"
If .Execute 0 Then
Workbooks.Open Filename:="C:\Text.xls"
End If
End With







NickHK

Application.Filesearch
 
The dubious results of FileSearch mean that you cannot rely on them.
Seems like MS have given up on it in the 2007 version anyway.
http://forums.microsoft.com/TechNet/...7153&SiteID=17

NickHK

"EA" wrote in message
...
I always use DIR myself, but an inexperienced programmer asked me the
question below and I had not answer for him, especially when he
demonstrated.

I was hoping one of the MVPs would offer some input.


"NickHK" wrote in message
...
FileSearch seems so flakey that it best avoided.
Use Dir or better GetAttr to determine if the file exists.

NickHK

"EA"
...
Can anyone please advise why the code below worked with Excel 2000 but
not with Excel 2003?

With Application.FileSearch
.Filename = "C:\Test.xls"
If .Execute 0 Then
Workbooks.Open Filename:="C:\Text.xls"
End If
End With










All times are GMT +1. The time now is 01:04 AM.

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