Missing VBA Code in Excel 2007

  • Thread starter Thread starter Rob
  • Start date Start date
R

Rob

Hi,

I have been trying Excel 2007 and one of my models that works fine in Excel
2000, doesn't run the VBA code below, if I retype this the option from the
prompt , suggests that FileSearch is no long an option. Surely this can't
be true?

With Application.FileSearch
.NewSearch

Thanks, Rob
 
I am afraid that it is true, FileSearch has been dropped from 2007 (it was
buggy, and MS decided to drop it rather than invest in fixing it).

Look at Dir in help, it will achieve the same results.

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)
 
Bob,

Shame about the change in 2007, have looked at help but unsure where to go
with this change in code as had removed Excel 2000 and can't search help to
find out what FileSearch was doing. Is it a case of changing just part of
the code or all of it? I have placed part of the code below that seems to
be falling over. Thanks, Rob

With Application.FileSearch
.NewSearch
.LookIn = "N:\UniSE\" & Worksheets("Sheet1").Range("Year") &
"\SALES\"
.SearchSubFolders = False
.Filename = "SALE" & Worksheets("Sheet1").Range("WK") & ".xls"
.MatchTextExactly = True
If .Execute() Then
 
Try this instead

If Dir("N:\UniSE\" & Worksheets("Sheet1").Range("Year") & "\SALES\" & _
"SALE" & Worksheets("Sheet1").Range("WK") & ".xls") <> "" Then


--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)
 
Thanks for you help. The revised code worked insomuch that the run error
happened after the DIR code on

Workbooks.Open Filename:=.FoundFiles(1)

If the code could work, I'd then somehow need to save the file in DBF format
which Excel 2007 doesn't appear to support. Hopefully, 2008 will see a
version which is more compatible.

Thanks, Rob
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top