VBA code working in excel2003 but not in excel2007

K

Kang Onechoon

I have several macros written for excel which use filesearch method retrieve
files within a directory. It appears that Office 2007 no longer supports
this.
Any suggestions on how to replace this code ?
---------------------------------------------------------------------------------------------
Sub fileSearchff()
Dim intNum As Integer
With Application.FileSearch
.NewSearch
.Filename = "*.xls"
.LookIn = "C:\"
.SearchSubFolders = True
.Execute

Application.DisplayAlerts = False

For intNum = 1 To .FoundFiles.Count
Workbooks.Open Filename:=.FoundFiles(intNum)
ActiveWorkbook.SaveAs Filename:=.FoundFiles(intNum), _
FileFormat:=xlNormal, Password:="aaaaa", WriteResPassword:="",
ReadOnlyRecommended:=False, CreateBackup:=False



ActiveWorkbook.Close
Cells(intNum, 1) = .FoundFiles(intNum)
Next

Application.DisplayAlerts = True

End With
End Sub

Thank you in advance
 

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