I have a sub that works in excel 2003 but not works in excel 2007 error: With Application.FileSearch

heliorq

New Member
Joined
Sep 4, 2015
Messages
2
Dear friends. I have a sub in a macro excel, that works weel in 2003, but not works in excel 2007 or 2010, apper to depure when get the line : With Application.FileSearch .
Thanks for any help.

the sub is :
Code:
Sub MostraPADTEC()


    Range("15:16").Select
    Selection.EntireRow.Hidden = False


    Range("29:34").Select
    Selection.EntireRow.Hidden = False
     
    Range("17:22,23:28").Select
    Selection.EntireRow.Hidden = True
    Range("B30").Select
    
Dim Classeurs() As String, I As Long, Aux1 As Integer
With Application.FileSearch
      .NewSearch
     .FileType = msoFileTypeExcelWorkbooks ' p/ excel
     '.FileType = msoFileTypeWordDocuments ' p/ word
     '.FileType = msoFileTypePowerPointPresentations 'p/powerpoint
     '.FileType = msoFileTypeOfficeFiles    ' p/ todos
      .Filename = "*.*" 'p/ txt
      .LookIn = "C:\CIGR-DWDM\NIVEIS ÓPTICOS\SAPO\Entrada\PADTEC"   ' localiza os arquivos contidos em C:\
      .SearchSubFolders = True
      .Execute
With .FoundFiles
      ReDim Classeurs(1 To .Count, 1 To 2)
      For I = 1 To .Count
            Aux1 = Len(.Item(I)) - InStr(1, StrReverse(.Item(I)), "\")
            Classeurs(I, 1) = Mid(.Item(I), 1, Aux1 + 1)
            Classeurs(I, 2) = Mid(.Item(I), Aux1 + 2)
      Next I
Application.ScreenUpdating = True
With Range("AC1000").Resize(.Count, 2)
      .Value = Classeurs
      .Sort [AC1000]
Range("A15").Select
End With
End With
End With


Range("B30:E30").Select
Selection.ClearContents
Range("B30").Select
     
End Sub
---------------------
next sub is :
 
Last edited by a moderator:

Excel Facts

Select a hidden cell
Somehide hide payroll data in column G? Press F5. Type G1. Enter. Look in formula bar while you arrow down through G.

Forum statistics

Threads
1,214,641
Messages
6,120,693
Members
448,979
Latest member
DET4492

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top