Thread: excel 2007
View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Pedro Pedro is offline
external usenet poster
 
Posts: 25
Default excel 2007

How to change the following macro in order to work in excel 2007:
Sub SearchFiles()

With Application.FileSearch
.NewSearch
.LookIn = "F:\My Documents\"
.SearchSubFolders = True
.Filename = strFileName & ".xls"
.FileType = msoFileTypeExcelWorkbooks
If .Execute() 0 Then
For i = 1 To .FoundFiles.Count
If LCase(Right(.FoundFiles(i), Len(strFileName & ".xls") + 1)) =
"\" & LCase(strFileName & ".xls") Then
Workbooks.Open .FoundFiles(i), UpdateLinks:=3
Exit For
End If
Next i
Else
'MsgBox "There were no files found."
End If
End With

End Sub


Regards, Pedro