Marco Directory Search Problem from excel 2000 to 2007

Graham182

New Member
Joined
Jan 31, 2010
Messages
31
Hi i've just upgraded my Excel from 2000 to 2007 and now this macro have stop working


Sub Dirlist()
Dim i As Long
With Application.FileSearch
.NewSearch
' *** Change Folder name to suit ***
.LookIn = "C:\My Documents"
.SearchSubFolders = True

Dir (Folder & "\" & Extension)
.Filename = "*.xls*"
If .Execute > 0 Then
For i = 1 To .FoundFiles.Count
Cells(i, 1).Value = Right(.FoundFiles(i), InStr(StrReverse(.FoundFiles(i)), "\") - 1)
Next

End If
End With
End Sub

it stops at 'With Application.FileSearch' and i'm not sure what to put in inorder for it to carry on working
it used to look through all my MyDocuments and pick out any XLS files
can anyone help :)
Thanks
Graham
 

Some videos you may like

Excel Facts

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.

Graham182

New Member
Joined
Jan 31, 2010
Messages
31
Look at the Attached it seems that Application.FileSearch is no longer avalible, i'm unfortuatly not great with macro's but know my way around a bit.

in this i've try to copy what 'NatoC' was saying but it seem he was trying to rename all these files. but when i'm trying to copy any of this myself it isn't working.

I'm guessing there's no quick fix, but is there any other search which would pull up all the .Xls filenames in the folder and subfolders

Thanks
Graham
 

Norie

Well-known Member
Joined
Apr 28, 2004
Messages
76,047
Office Version
  1. 365
Platform
  1. Windows
Graham

What is the code meant to do?
 

Graham182

New Member
Joined
Jan 31, 2010
Messages
31

ADVERTISEMENT

Re: Macro Directory Search Problem from excel 2000 to 2007

Ok i'm not that good at macro's and this is my slight problem, I understood my old macros.
But what i'm ultimatly trying to do is create a macro
that will list all the Excel filename in a folder and subfolder.
that will work in 2007?
as the macro i listed above stopped working what i upgraded to 2007.

I can't install any tool as its a works PC.

If anyone has a simple way?
 

Norie

Well-known Member
Joined
Apr 28, 2004
Messages
76,047
Office Version
  1. 365
Platform
  1. Windows
Re: Macro Directory Search Problem from excel 2000 to 2007

Graham

Can you tell us what you are actually trying to achieve?

Without knowing that all we can do is guess and then make suggestions based on those guesses.:)
 

taigovinda

Well-known Member
Joined
Mar 28, 2007
Messages
2,639
Re: Macro Directory Search Problem from excel 2000 to 2007

If I were you, I'd consider installing the linked material in post #5 on my home machine, then copying the code and re-creating the program on my work computer. I've never actually used it, but I read the intro and Chip said you can view all the code once you run the add-in...
 

Watch MrExcel Video

Forum statistics

Threads
1,118,102
Messages
5,570,222
Members
412,310
Latest member
ForceFollower
Top