Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

with Application.FileSearch in Office 2013

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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Outlook Free & Paid Tools
Freeze panes is an option within all variants of Excel to enable parts of a sheet to remain stationary when the cursor is in another part of the sheet. This is a very useful feature which is overlooked or under used.
This Micro Tutorial demonstrate the bugs in Microsoft Excel for Mac with Pivot Charts.
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa‚Ķ

808 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