Solved

with Application.FileSearch in Office 2013

Posted on 2013-05-13
3
1,181 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

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
In this article we discuss how to recover the missing Outlook 2011 for Mac data like Emails and Contacts manually.
This Micro Tutorial will demonstrate the scrolling table in Microsoft Excel using the INDEX function.
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.

757 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

22 Experts available now in Live!

Get 1:1 Help Now