Link to home
Create AccountLog in
Avatar of P-R-W
P-R-WFlag for Netherlands

asked on

with Application.FileSearch in Office 2013

Hello,

When I convert an excel 2003 workbook to a 2013 workbook, I get the error that "with Application.Filesearch"  is not supported. I found on the web the info that it has been taken out by Microsoft and that you should use the FileSystemObject. I'm having some problems with the correct code. The code I used to use is:

With Application.FileSearch
        .NewSearch
        .LookIn = "L:\TEMP"
         RptName = Range("B6").Value 'VARIABLE PER DAY!!!!
         ComName = RptName & ".TXT"
                .Filename = ComName
            If .Execute > 0 Then 'Workbook exists

                    do some stuff

           Else 'There is Not a File available
            
                    do some stuff
          End If
End With

Open in new window


Could anybody help with alternative code?

Many thanks!!
ASKER CERTIFIED SOLUTION
Avatar of Patrick Matthews
Patrick Matthews
Flag of United States of America image

Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
Avatar of P-R-W

ASKER

Just what I needed.
Thanks