Hi all,
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
Can you guys help me edit this to get it working again?
Thanks
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
Code:
Public Sub onstart()
Dim fs
Dim i As Integer
Dim stlen As Integer
Set fs = [B]Application.FileSearch
[/B]With fs
.LookIn = ActiveWorkbook.Path
.filename = "*.rpt"
ComboBox1.Clear
ComboBox1.Text = ""
If .Execute(SortBy:=msoSortByFileName, SortOrder:=msoSortOrderAscending) > 0 Then
stlen = Len(ActiveWorkbook.Path) + 2
For i = 1 To .FoundFiles.Count
ComboBox1.AddItem Mid(.FoundFiles(i), stlen)
Next i
ComboBox1.Value = Mid(.FoundFiles(1), stlen)
populate_archive
Else
ComboBox1.Value = NOFILES
End If
End With
End Sub
Public Sub listbox_onstart()
Dim fs
Dim i As Integer
Dim stlen As Integer
Set fs = [B]Application.FileSearch
[/B]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