Application.FileSearch in 2007

G

Gilgamesh

Hello,
I have just upgraded to 2007 and several macros I have using
Application.FileSearch are now failing. The help files that show
differences to the previous version say that FileSearch is now Hidden yet
there are many examples scattered through the help files still using it.

Can anyone tell me the process to un-hide this or what the replacement
function is so that I can recode the macros.

Thank You
 
S

Steve Rindsberg

Hello,
I have just upgraded to 2007 and several macros I have using
Application.FileSearch are now failing. The help files that show
differences to the previous version say that FileSearch is now Hidden yet
there are many examples scattered through the help files still using it.

The help files are riddled with that sort of thing and not to be trusted fully.
Can anyone tell me the process to un-hide this or what the replacement
function is so that I can recode the macros.

Try this: in the VBA editor, press F2 to open the object browser. Rightclick
in the right/lower pane of the object browser and put a check next to Show
Hidden.

Now try compiling/running your code.

There's no replacement function that I know of, but depending on how you're
using FileSearch you may want to write your own replacement functions.
 
G

Gilgamesh

FileSearch is not available in XL 2007. Use FileSystemObject instead.

http://msdn.microsoft.com/en-us/library/6kxy1a51(VS.85).aspx

HTH,
JP


Hello,
Thanks for the response. I've been spending some time reading up on and
playing with the FileSystemObject. It has quite a few features that
simplify my code, I suppose that's a godd reason to replace FileSearch.

However I was hoping you could help further with a question on its use.
When I used FileSearch I could put in a wildcard to only pick certain files.
I then used .count to see it any existed.
I tried using a wildcard like fso.FileExists("d:\*.mpp"), but this always
returns false even if files do exist. I did some searching on the link you
provided which indicated a wildcard should be % rather than * but when I
plugged that in I still got a False value returned.

What is the correct way of defining wild cards to work?
The .Net versions I'm using are 1.1 and 2.0 (newer versions can't be
installed as it is a corporate PC image).

Thank You
 

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