Home > Forum Home > Analyzing Corporate Financial Data > VBA Application.Filesearch workaround Share

VBA Application.Filesearch workaround

Excel Help for Vba Application.filesearch Workaround in Analyzing Corporate Financial Data

Forum TopicPost Reply Login

Vba Application.filesearch Workaround

Rate this:
(3/5 from 1 vote)
ConfusedI REALLY need a fix for the application.filesearch function that is currently in some old code which works in Excel 2003 and before but not in Excel 2007. I have heard suggestions on fixing this by using the Dir function but with my limited knowledge and no time I need expertise...PLEASE HELP!!!!

VBA Code:
Call GetBrowse 'goes to a sub that allows you to pick a file with multiple excel files...after running through it jumps back to the Application.Filesearch below and gets stuck due to it being removed from 2007
With Application.FileSearch
.LookIn = strPath
.Filename = "*.xls"
If .Execute() > 0 Then
WrWrkBk = ActiveWorkbook.Name
x = Workbooks(WrWrkBk).Worksheets.Count

sort = 8
For i = 1 To counter - 1
Application.ScreenUpdating = False
strfile = .FoundFiles(i)

Find_Last_Slash (strfile)
strfile = Mid(strfile, 1, position)
a = a + 1
strDiv = Workbooks(RdWrkBk1).Sheets(1).Cells(a, sort).Value
strfile = strfile & strDiv & ".xls"

Workbooks.Open strfile 'open workbook

Find_Last_Slash (strfile)
RdWrkBk = Trim(Mid(strfile, position + 1, 50))
 Posted by on
Replies - Displaying 1 to 1 of 1Order Replies By: Most Recent | Chronological | Highest Rated
Rate this:
(3/5 from 1 vote)
You can loop through files in a directory using the Dir function:
VBA Code:
Sub LoopThroughXLS()
    Dim sFName As String
    sFName = Dir(”*.xls”)
    Do While Len(sFName) > 0
        Debug.Print sFName
        sFName = Dir
End Sub

 Excel Business Forums Administrator
 Posted by on
 Displaying page 1 of 1 

Find relevant Excel templates and add-ins for VBA Application.Filesearch workaround in the