ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Filesearch error in Excel 2007 (https://www.excelbanter.com/excel-programming/405816-filesearch-error-excel-2007-a.html)

Libby

Filesearch error in Excel 2007
 
Hi

I have a sub that add files in a folder to a listbox. It worked fine in
Excel 2003, but now in Excel 2007 it doesn't and I get an error.

the code is below

Sub Fill_Listbox
strDir = path of folder
ChrDir strDir
With Application.Filesearch
.NewSearch
.LookIn = strDir
.SearchSubFolders = False
.FileType = msoFileTypeAllFiles
If .Excecute() 0 Then
For i = 1 to .FoundFiles.Count
'Add file name to listbox
Next i
end if
End with

I've stepped though and the error occurs at the With Application.FileSearch
part.

The error is Run-time error 445. Object doesn't support this action.


Can anyone tell my why this doesn't work in Excel 2007 and if possible how
to achieve the same results using Excel 2007?

Many thanks in advance.




Ron de Bruin

Filesearch error in Excel 2007
 
Hi Libby

It is removed from 2007

You can use Dir or FSO
See the merge code on my site, you can use that for your macro
http://www.rondebruin.nl/copy3.htm

--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"Libby" wrote in message ...
Hi

I have a sub that add files in a folder to a listbox. It worked fine in
Excel 2003, but now in Excel 2007 it doesn't and I get an error.

the code is below

Sub Fill_Listbox
strDir = path of folder
ChrDir strDir
With Application.Filesearch
.NewSearch
.LookIn = strDir
.SearchSubFolders = False
.FileType = msoFileTypeAllFiles
If .Excecute() 0 Then
For i = 1 to .FoundFiles.Count
'Add file name to listbox
Next i
end if
End with

I've stepped though and the error occurs at the With Application.FileSearch
part.

The error is Run-time error 445. Object doesn't support this action.


Can anyone tell my why this doesn't work in Excel 2007 and if possible how
to achieve the same results using Excel 2007?

Many thanks in advance.




Gary''s Student

Filesearch error in Excel 2007
 
I don't think filesearch is supported in 2007.

http://groups.google.com/group/micro...190c9a6bb55117
--
Gary''s Student - gsnu200768


"Libby" wrote:

Hi

I have a sub that add files in a folder to a listbox. It worked fine in
Excel 2003, but now in Excel 2007 it doesn't and I get an error.

the code is below

Sub Fill_Listbox
strDir = path of folder
ChrDir strDir
With Application.Filesearch
.NewSearch
.LookIn = strDir
.SearchSubFolders = False
.FileType = msoFileTypeAllFiles
If .Excecute() 0 Then
For i = 1 to .FoundFiles.Count
'Add file name to listbox
Next i
end if
End with

I've stepped though and the error occurs at the With Application.FileSearch
part.

The error is Run-time error 445. Object doesn't support this action.


Can anyone tell my why this doesn't work in Excel 2007 and if possible how
to achieve the same results using Excel 2007?

Many thanks in advance.




Libby

Filesearch error in Excel 2007
 
Thanks again.

Another thing not supported by the new Excel. So far I'm struggling to see
any advantages.

"Ron de Bruin" wrote:

Hi Libby

It is removed from 2007

You can use Dir or FSO
See the merge code on my site, you can use that for your macro
http://www.rondebruin.nl/copy3.htm

--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"Libby" wrote in message ...
Hi

I have a sub that add files in a folder to a listbox. It worked fine in
Excel 2003, but now in Excel 2007 it doesn't and I get an error.

the code is below

Sub Fill_Listbox
strDir = path of folder
ChrDir strDir
With Application.Filesearch
.NewSearch
.LookIn = strDir
.SearchSubFolders = False
.FileType = msoFileTypeAllFiles
If .Excecute() 0 Then
For i = 1 to .FoundFiles.Count
'Add file name to listbox
Next i
end if
End with

I've stepped though and the error occurs at the With Application.FileSearch
part.

The error is Run-time error 445. Object doesn't support this action.


Can anyone tell my why this doesn't work in Excel 2007 and if possible how
to achieve the same results using Excel 2007?

Many thanks in advance.





ilia

Filesearch error in Excel 2007
 
Answered he

http://groups.google.com/group/micro...03da44cc?hl=en


On Feb 8, 1:46 pm, Libby wrote:
Thanks again.

Another thing not supported by the new Excel. So far I'm struggling to see
any advantages.

"Ron de Bruin" wrote:
Hi Libby


It is removed from 2007


You can use Dir or FSO
See the merge code on my site, you can use that for your macro
http://www.rondebruin.nl/copy3.htm


--


Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"Libby" wrote in ...
Hi


I have a sub that add files in a folder to a listbox. It worked fine in
Excel 2003, but now in Excel 2007 it doesn't and I get an error.


the code is below


Sub Fill_Listbox
strDir = path of folder
ChrDir strDir
With Application.Filesearch
.NewSearch
.LookIn = strDir
.SearchSubFolders = False
.FileType = msoFileTypeAllFiles
If .Excecute() 0 Then
For i = 1 to .FoundFiles.Count
'Add file name to listbox
Next i
end if
End with


I've stepped though and the error occurs at the With Application.FileSearch
part.


The error is Run-time error 445. Object doesn't support this action.


Can anyone tell my why this doesn't work in Excel 2007 and if possible how
to achieve the same results using Excel 2007?


Many thanks in advance.




All times are GMT +1. The time now is 02:58 AM.

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