Application.FileFind in Excel X

N

Neil

I'm curious as to whether anyone else can make the VBA command
Application.FileFind work in Excel X running on OS X.2.8.

This function is used to identify files within a designated folder (at a
specified search path).

My code using this function works like a charm in Excel 98 running on OS
9.2. The code executes in X, but the number of files returned is always
zero. I experimented with it for hours to no avail. I even had the same
result when running the sample code provided in the VBA help file.

Any guidance would be very much appreciated.

Neil
 
J

J.E. McGimpsey

Neil said:
I'm curious as to whether anyone else can make the VBA command
Application.FileFind work in Excel X running on OS X.2.8.

This function is used to identify files within a designated folder (at a
specified search path).

My code using this function works like a charm in Excel 98 running on OS
9.2. The code executes in X, but the number of files returned is always
zero. I experimented with it for hours to no avail. I even had the same
result when running the sample code provided in the VBA help file.

Any guidance would be very much appreciated.

I have no problem with .FileFind in Excel v.X (10.1.5). Couple of
things to check:

The usual suspects:
- Make sure you've updated XL with updates 10.1.2, 10.1.4 and 10.1.5
from

MacTopia Downloads
http://www.microsoft.com/mac/downloads.aspx

- Try repairing permissions:

Run the Disk Utility (in the ./Applications/Utilities
folder). From the First Aid tab, click "Repair Disk Permissions".

Other suspects:

- Do you have permission for the file path you're specifying?

- Since .FileFind just implements the FindFile dialog, do you get a
different result if you use

Application.FindFile

and enter the same information in the dialog?
 
N

Neil

First, thanks to Jim and J.E. for responding.

An interesting twist ...


I put the following into the code module of a new workbook

Sub test()
With Application.FileFind
.Options = msoOptionsNew
.SearchPath = "Macintosh HD"
.SearchSubFolders = True
.Execute

MsgBox "Number of files found " & Str(.FoundFiles.Count)

End With

End Sub


This should identify every file on my hard drive. When I heard the drive
spinning like crazy, I said to myself at least FileFind works at one level.
I was going to interrupt execution, but I waited a few minutes and the sub
finished normally. But it found only 82 files, which was crazy since I have
thousands. So, I had it print the name of each item in the FoundFiles
object. I saw Word, PowerPoint, alias, etc., files from many different
folders. Then I noticed that the word "roadmap" was contained in each file
name. Sure enough, when I used the Immediate window to access the FileName
property of the FileFind object, the response was "roadmap."

I don't remember ever setting the FileName property, but once upon a time I
must have once searched for "roadmap."

I then went back to my original code and added .FileName =""

Everything worked.

The lesson learned is to set the property manually when performing a new
search.


Neil
 

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