Filesearch error in Excel 2007

L

Libby

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

Libby

Thanks again.

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

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