geebra
03-14-2014, 10:29 AM
I recently updated to Office 2010 and some of my previous macro are not working and I have received runtime error 445. I did some reaseach and realized that it no longer support the Application.Filesearch.
Sub listbox_onstart()
Dim fsDim i As Integer
Dim stlen As Integer
Set fs = Application.FileSearch
With fs
.LookIn = ActiveWorkbook.Path
.filename = "*.rpt"
ListBox1.Clear
If .Execute(SortBy:=msoSortByFileName, SortOrder:=msoSortOrderAscending) > 0 Then
stlen = Len(ActiveWorkbook.Path) + 2
For i = 1 To .FoundFiles.Count
ListBox1.AddItem Mid(.FoundFiles(i), stlen)
Next i
End If
End With
End Sub
Can you guys help me edit this to get it working again?Thanks sorry guys I tried putting it in a easier to read format, but it is not letting me. My apologies
Sub listbox_onstart()
Dim fsDim i As Integer
Dim stlen As Integer
Set fs = Application.FileSearch
With fs
.LookIn = ActiveWorkbook.Path
.filename = "*.rpt"
ListBox1.Clear
If .Execute(SortBy:=msoSortByFileName, SortOrder:=msoSortOrderAscending) > 0 Then
stlen = Len(ActiveWorkbook.Path) + 2
For i = 1 To .FoundFiles.Count
ListBox1.AddItem Mid(.FoundFiles(i), stlen)
Next i
End If
End With
End Sub
Can you guys help me edit this to get it working again?Thanks sorry guys I tried putting it in a easier to read format, but it is not letting me. My apologies