Application FileSearch Object

R

Rick

The code below works on Windows 2000 or XP home machines,
but not on a XP Professional machine. With XP Pro no
files are found even though they are in the directory.
Can anyone help?

Set fs = Application.FileSearch
With fs
.NewSearch
.lookin = "C:\WCReportCreator\ImportFiles"
.FileName = "*.xls"

If .Execute > 0 Then
For i = 1 To .foundfiles.Count
lstSpreadSheets.AddItem .foundfiles(i)
Next i
Else
MsgBox "There are no files found to import."
End If
End With

Thanks

Rick
 
W

Wolfgang

Hi,

we just found out that you can apply certain policies (so
for example to remove the SEARCH-item from your start-
menu) and through this the application.FileSearch does not
work any more.

So maybe it's just a question of proper user-rights or
administration of your machine?

Hope that helps
Wolfgang
 
K

Ken Macksey

Hi

Did you try using

.FileName = ".xls" (that is dot xls)

instead of

.FileName = "*.xls"

HTH

Ken
 
R

Rick

Thanks for your help. I suspected it was something like
that. Do you have any idea what policy specifically could
be the problem?
 
W

Wolfgang

Could be the following:
Start | Execute | enter "gpedit.msc" and OK. (WinXP)

I actually don't have an english windows on the hands so I
try to translate the following:

Under 'user configuration' you find a
folder 'administrative templates' and in this a nesting
folder 'start menu and task bar'.
On the right side you see a whole list and the problem
could be raised through 'delete search from start menu'.

Greetz
Wolfgang
 

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

Top