Solved

with Application.FileSearch in Office 2013

Posted on 2013-05-13
3
1,198 Views
Last Modified: 2013-05-13
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!!
0
Comment
Question by:P-R-W
3 Comments
 
LVL 92

Accepted Solution

by:
Patrick Matthews earned 500 total points
ID: 39161209
You don't need FSO just to test for a file's existence.

If Dir("L:\TEMP\" & Range("B6") & ".TXT") <> "" Then
    ' exists
Else
    ' does not exist
End If

Open in new window

0
 

Author Closing Comment

by:P-R-W
ID: 39161599
Just what I needed.
Thanks
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Microsoft Office Picture Manager is not included in Office 2013. This comes as a shock to users upgrading from earlier versions of Office, such as 2007 and 2010, where Picture Manager was included as a standard application. This article explains how…
No matter the version of Windows you are using, you may have some problems with Windows Search running too slow or possibly not running at all. Before jumping into how you can solve this issue, just know there are many other viable alternative deskt…
This Micro Tutorial will demonstrate how to create pivot charts out of a data set. I also added a drop-down menu which allows to choose from different categories in the data set and the chart will automatically update.
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

914 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now