[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

with Application.FileSearch in Office 2013

Posted on 2013-05-13
3
Medium Priority
?
1,360 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
2 Comments
 
LVL 93

Accepted Solution

by:
Patrick Matthews earned 2000 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Microsoft's Excel has many features that most people will never need nor take advantage of.  Conditional formatting is one feature that you may find a necessity once you start using it.
We live in a world of interfaces like the one in the title picture. VBA also allows to use interfaces which offers a lot of possibilities. This article describes how to use interfaces in VBA and how to work around their bugs.
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

830 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