We have just moved to Windows 7 Microsoft 2010 and a macro that worked on the old format has died!!!
I get an error message on line 9 With Application.FileSearch
Run time error '445'
Object doesn't support this action, at this part of the code, has this been updated by any chance?
Sub OB_new()
Dim vaFileName As Variant
Dim Sheetname As String
Dim vaWorkbook As String
Dim Thisfile As String
Dim BookToOpen As String
Const MyDir As String = "T:\Litigation & WOC Team\EXPERIAN TEAM\OneBill\1File"
'the location of the workbooks
'On Error Resume Next
With Application.FileSearch
.NewSearch
.LookIn = MyDir
'the directory to search in
.SearchSubFolders = False
.FileType = msoFileTypeAllFiles
If .Execute > 0 Then
'workbooks found
Application.ScreenUpdating = False
For Each vaFileName In .FoundFiles
'loop through each found workbook
ProcessData vaFileName
'pass workbook fullname to copy routine
Next
Else
MsgBox "There were no files found."
End If
Application.ScreenUpdating = True
End With
I get an error message on line 9 With Application.FileSearch
Run time error '445'
Object doesn't support this action, at this part of the code, has this been updated by any chance?
Sub OB_new()
Dim vaFileName As Variant
Dim Sheetname As String
Dim vaWorkbook As String
Dim Thisfile As String
Dim BookToOpen As String
Const MyDir As String = "T:\Litigation & WOC Team\EXPERIAN TEAM\OneBill\1File"
'the location of the workbooks
'On Error Resume Next
With Application.FileSearch
.NewSearch
.LookIn = MyDir
'the directory to search in
.SearchSubFolders = False
.FileType = msoFileTypeAllFiles
If .Execute > 0 Then
'workbooks found
Application.ScreenUpdating = False
For Each vaFileName In .FoundFiles
'loop through each found workbook
ProcessData vaFileName
'pass workbook fullname to copy routine
Next
Else
MsgBox "There were no files found."
End If
Application.ScreenUpdating = True
End With