I have this macro that I use for book keeping that works perfectly in 03 but gives the following error in 07. I would run the macro it would prompt to select my invoice folder then tally up all the numbers from invoices that meet a certain requirement. Now, whenever I select the folder I get,
"object doesn't support this action"
I am at a loss I am new to this macros in general much less modifying between versions...
any ideas?
"object doesn't support this action"
I am at a loss I am new to this macros in general much less modifying between versions...
Code:
Function GetFolder() As String
Dim dlg As FileDialog
Set dlg = Application.FileDialog(msoFileDialogFolderPicker)
If dlg.Show = -1 Then
GetFolder = dlg.SelectedItems(1)
End If
End Function
Sub Invoice(strRange As String)
Dim fs As FileSearch
Dim lngCounter As Long, lngRow As Long, lngOutputrow As Long
Dim wbk As Workbook, wks1 As Worksheet, wks2 As Worksheet, wksSummary As Worksheet
Dim rngData As Range, rngCell As Range
Dim strCompany As String, strParentFolder As String
strParentFolder = GetFolder()
If Len(strParentFolder) = 0 Then Exit Sub
Application.ScreenUpdating = False
Set wksSummary = ActiveWorkbook.ActiveSheet
lngOutputrow = 2
Set fs = Application.FileSearch
With fs
.NewSearch
.LookIn = strParentFolder
.SearchSubFolders = False
.Filename = "06*.xls"
.MatchTextExactly = True
.FileType = msoFileTypeExcelWorkbooks
.Execute
' Loop through all the found files
For lngCounter = 1 To .FoundFiles.Count
Set wbk = Workbooks.Open(.FoundFiles(lngCounter))
With wksSummary
.Cells(lngOutputrow, 1) = wbk.Name
End With
lngOutputrow = lngOutputrow + 1
wbk.Close False
Next lngCounter
Set wbk = Nothing
End With
Set fs = Nothing
Application.ScreenUpdating = True
End Sub
any ideas?