Object Doesn't Support This Action<p align=left><font face=Arial size=2>Whenever I run the following section of code, I get the run-time error '445': Object doesn't support this action.  It is refering to using the FileSearch method with the Application object.  I know that in Excel 2003, this method did support this action, but now that I'm trying to do it with Excel 2007, it is giving me this error.  I'm just wondering if there is a new method that has taken the place of FileSearch, and if there is, what that method would be.</font></p> <p align=left> </p> <p align=left>Dim cp As Workbook<br>Dim cp2 As Long<br>Dim cp3 As Integer<br><font color="#ff0000">With Application.FileSearch</font><br>.NewSearch<br>.LookIn = &quot;C:\Users\D\Desktop\2008\VBA Test\CP&quot;<br>.Filename = &quot;*.xls&quot;<br>If .Execute(SortBy:=msoSortByLastModified, SortOrder:=msoSortOrderDescending) &gt; 0 Then<br>For i = .FoundFiles.Count To 1 Step -1<br>Set cp = Workbooks.Open(.FoundFiles(i))<br>cp.Activate<br>Range(&quot;B9:B574&quot;).AdvancedFilter Action:=xlFilterCopy, CopyToRange:=Range(&quot;Z10&quot;), Unique:=True<br>Range(&quot;Z10&quot;).Activate<br>cp3 = 0<br>For cp2 = 1 To 100<br>Do<br>ActiveCell.Offset(1, 0).Select<br>Loop Until IsEmpty(ActiveCell.Offset(1, 0))<br>If ActiveCell.Offset(2, 0).Value = 0 Then<br>cp3 = cp3 + ActiveCell.Row - 10<br>Exit For<br>Else<br>cp3 = cp3 - 1<br>ActiveCell.Offset(2, 0).Select<br>End If<br>Next cp2<br>Workbooks(&quot;VBA Test.xls&quot;).Activate<br>Worksheets(&quot;Sheet1&quot;).Activate<br>If i = 1 Then<br>Cells(1, 2).Value = cp3<br>ElseIf i = 2 Then<br>Cells(1, 3).Value = cp3<br>ElseIf i = 3 Then<br>Cells(1, 4).Value = cp3<br>ElseIf i = 4 Then<br>Cells(1, 5).Value = cp3<br>ElseIf i = 5 Then<br>Cells(1, 6).Value = cp3<br>ElseIf i = 6 Then<br>Cells(1, 7).Value = cp3<br>ElseIf i = 7 Then<br>Cells(1, 8).Value = cp3<br>ElseIf i = 8 Then<br>Cells(1, 9).Value = cp3<br>ElseIf i = 9 Then<br>Cells(1, 10).Value = cp3<br>ElseIf i = 10 Then<br>Cells(1, 11).Value = cp3<br>ElseIf i = 11 Then<br>Cells(1, 12).Value = cp3<br>ElseIf i = 12 Then<br>Cells(1, 13).Value = cp3<br>End If<br>Next i<br>End If<br>End With</p> <p align=left> </p> <p align=left>Thanks.</p>© 2009 Microsoft Corporation. All rights reserved.Wed, 10 Dec 2008 23:25:30 Za46e3827-1fb5-4a08-8b07-dd7a0eaeead8http://social.msdn.microsoft.com/Forums/en-US/isvvba/thread/a46e3827-1fb5-4a08-8b07-dd7a0eaeead8#a46e3827-1fb5-4a08-8b07-dd7a0eaeead8http://social.msdn.microsoft.com/Forums/en-US/isvvba/thread/a46e3827-1fb5-4a08-8b07-dd7a0eaeead8#a46e3827-1fb5-4a08-8b07-dd7a0eaeead8Eazy-Dhttp://social.msdn.microsoft.com/Profile/en-US/?user=Eazy-DObject Doesn't Support This Action<p align=left><font face=Arial size=2>Whenever I run the following section of code, I get the run-time error '445': Object doesn't support this action.  It is refering to using the FileSearch method with the Application object.  I know that in Excel 2003, this method did support this action, but now that I'm trying to do it with Excel 2007, it is giving me this error.  I'm just wondering if there is a new method that has taken the place of FileSearch, and if there is, what that method would be.</font></p> <p align=left> </p> <p align=left>Dim cp As Workbook<br>Dim cp2 As Long<br>Dim cp3 As Integer<br><font color="#ff0000">With Application.FileSearch</font><br>.NewSearch<br>.LookIn = &quot;C:\Users\D\Desktop\2008\VBA Test\CP&quot;<br>.Filename = &quot;*.xls&quot;<br>If .Execute(SortBy:=msoSortByLastModified, SortOrder:=msoSortOrderDescending) &gt; 0 Then<br>For i = .FoundFiles.Count To 1 Step -1<br>Set cp = Workbooks.Open(.FoundFiles(i))<br>cp.Activate<br>Range(&quot;B9:B574&quot;).AdvancedFilter Action:=xlFilterCopy, CopyToRange:=Range(&quot;Z10&quot;), Unique:=True<br>Range(&quot;Z10&quot;).Activate<br>cp3 = 0<br>For cp2 = 1 To 100<br>Do<br>ActiveCell.Offset(1, 0).Select<br>Loop Until IsEmpty(ActiveCell.Offset(1, 0))<br>If ActiveCell.Offset(2, 0).Value = 0 Then<br>cp3 = cp3 + ActiveCell.Row - 10<br>Exit For<br>Else<br>cp3 = cp3 - 1<br>ActiveCell.Offset(2, 0).Select<br>End If<br>Next cp2<br>Workbooks(&quot;VBA Test.xls&quot;).Activate<br>Worksheets(&quot;Sheet1&quot;).Activate<br>If i = 1 Then<br>Cells(1, 2).Value = cp3<br>ElseIf i = 2 Then<br>Cells(1, 3).Value = cp3<br>ElseIf i = 3 Then<br>Cells(1, 4).Value = cp3<br>ElseIf i = 4 Then<br>Cells(1, 5).Value = cp3<br>ElseIf i = 5 Then<br>Cells(1, 6).Value = cp3<br>ElseIf i = 6 Then<br>Cells(1, 7).Value = cp3<br>ElseIf i = 7 Then<br>Cells(1, 8).Value = cp3<br>ElseIf i = 8 Then<br>Cells(1, 9).Value = cp3<br>ElseIf i = 9 Then<br>Cells(1, 10).Value = cp3<br>ElseIf i = 10 Then<br>Cells(1, 11).Value = cp3<br>ElseIf i = 11 Then<br>Cells(1, 12).Value = cp3<br>ElseIf i = 12 Then<br>Cells(1, 13).Value = cp3<br>End If<br>Next i<br>End If<br>End With</p> <p align=left> </p> <p align=left>Thanks.</p>Fri, 04 Jul 2008 16:59:47 Z2008-07-04T16:59:47Zhttp://social.msdn.microsoft.com/Forums/en-US/isvvba/thread/a46e3827-1fb5-4a08-8b07-dd7a0eaeead8#e601612e-03d4-4fcb-8fdc-79506877bb34http://social.msdn.microsoft.com/Forums/en-US/isvvba/thread/a46e3827-1fb5-4a08-8b07-dd7a0eaeead8#e601612e-03d4-4fcb-8fdc-79506877bb34Shasurhttp://social.msdn.microsoft.com/Profile/en-US/?user=ShasurObject Doesn't Support This Action<p align=left><font face=Arial size=2>Hi</font></p> <p align=left> </p> <p align=left>Filesearch method is not available in Excel 2007. Here are some alternatives</p> <p align=left> </p> <p align=left><a title="http://www.mrexcel.com/forum/showthread.php?t=268046" href="http://www.mrexcel.com/forum/showthread.php?t=268046">http://www.mrexcel.com/forum/showthread.php?t=268046</a></p> <p align=left> </p> <p align=left><a title="http://www.ozgrid.com/forum/showthread.php?t=71409" href="http://www.ozgrid.com/forum/showthread.php?t=71409">http://www.ozgrid.com/forum/showthread.php?t=71409</a></p> <p align=left> </p> <p align=left>Cheers</p> <p align=left>Shasur</p> <p align=left> </p>Sat, 05 Jul 2008 02:56:23 Z2008-07-05T02:56:23Z