Using previous advice, I have tried to create a new find file method to replace my old one that worked in excel 2003, with my current excel 2010. I am getting a compile error type mismatch which is highlighted in red. I was hoping someone could point out the error in my ways. Any help would be appreciated.
Code:
Sub Openallworkbooks()
Dim lCount As Long
Dim wbResults As Workbook
Dim wbCodeBook As Workbook
Dim fs As Object
'
' Openallworkbooks Macro
' Macro recorded 3/30/2009
'
'Added 10/4/2011
[Red] Set fs = Application.FindFile [/Red]
With fs
'Set wbCodeBook = ThisWorkbook
'Commented out 10/4/2011
'With Application.FileSearch
'Commented out 10/4/2011
'Change path to suit
.LookIn = "C:\DailyC"
.Filename = "ETF*.xls"
'.FileType = msoFileTypeExcelWorkbooks
'With Application.FileSearch
'Commented out both lines 10/4/2011
' If .Execute > 0 Then 'Workbooks in folder
'Commented out line 10/4/2011
If .Execute(SortBy:=msoSortByFileName, _
SortOrder:=msoSortOrderAscending) > 0 Then
For lCount = 1 To .FoundFiles.Count 'Loop through all.
'Open Workbook x and Set a Workbook variable to it
Set wbResults = Workbooks.Open(Filename:=.FoundFiles(lCount), UpdateLinks:=0)
Next lCount
End If
End With
On Error GoTo 0
Application.ScreenUpdating = True
Application.DisplayAlerts = True
Application.EnableEvents = True
'
End Sub