Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default VBA Application.FileSearch

This function works on some WinXP Pro, Excel 2002
installations, but not on others. The function is
adapted from the example in
Microsoft Knowledge Base Article - 210613

Function LocateFile(strFileName As String)
Dim vItem As Variant
With Application.FileSearch
.Filename = strFileName
.LookIn = "C:\"
.SearchSubFolders = True
.Execute
Debug.Print .FoundFiles.Count
For Each vItem In .FoundFiles
Debug.Print vItem
Next vItem
End With
Debug.Print "Done"
End Function

It should print out all locations of the file given as an
argument. Here is a printout from the Immediate window,
showing that on my machine, Application.FileSearch fails
to find any files:

LocateFile "AUTOEXEC.BAT"
0
Done

Why does this function fail on my machine, but work on
Win98, WinME, and WinXP Home machines? Is it a security
issue similar to the one reported in the Knowledge Base
about using JET to execute FileSearch?

Thanks for any responses.
-Roger
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Application.FileSearch Cleberton(Brazilian) Excel Discussion (Misc queries) 2 October 26th 09 01:21 PM
macro to close excel application other than application.quit mary Excel Programming 1 September 14th 04 03:43 PM
EXCEL FILESEARCH GARY Excel Programming 2 January 8th 04 01:25 AM
FileSearch using VBA Mark[_31_] Excel Programming 2 December 24th 03 05:49 PM
.FileSearch Randall[_3_] Excel Programming 4 November 26th 03 01:48 AM


All times are GMT +1. The time now is 04:23 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"