Office Word Programming >> Application.FileSearch in Word2007 VBA

by Nancy22 » Sat, 23 Aug 2008 06:50:47 GMT

This bit of code is in a macro that used to run fine under Word2003:

With Application.FileSearch
.NewSearch
.LookIn = "c:\My Documents\myfile"
.SearchSubFolders = False
.FileName = lookFor

Now under Word2007, when I try to run the same macro, it stops at that line
and I get the error message "Run-time error 5111: This command is not
available on this platform."

What does this mean and how can I fix my old macro so that it works?



Similar Threads

1. Word2007 & Application.FileSearch

I have a number of macros that have been running since Word98, but now when 
run in Word2007 they blow out with an error #5111 - "This command is not 
available on this platform". When I ran it down it turned out to be the 
Application.Filesearch which was causing the error.  I checked the Object 
browser for Word2007 and All Libraries, it seems that the FileSearch doesn't 
exist anymore.

Is this true or am I missing something?

If it doesn't exist anymore how can I now search a directory for a file in 
Wood2007?

I use the Application.FileSearch in quite a few places in my macros.

Thanks,
Steve

2. Application.FileSearch VBA Loop Through Folders

3. Office 2007 - application.filesearch missing for VBA

I have several macros written for excel which use the application.filesearch 
method to retrieve files within a directory. It appears that Office 2007 no 
longer supports this. Any suggestions on how to replace this code?

4. Application.FileSearch.Execute problem in Project VBA

5. Application.FileSearch in VBA 2007

The very useful FileSearch method has been removed.  The easiest way to 
replace /most/ uses is with the FileSystemObject ... however, FileSearch had 
a .SearchSubFolders attribute that was very useful ... is there a good way 
to replicate this, or do I just have write a recursive routine using the 
FileSystemObject to build the list?

-- 
-Richard M. Hartman

186,000 mi/sec: not just a good idea, it's the LAW!


6. Application.FileSearch.Execute problem in Project VBA

7. Application.FileSearch in 2007

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


8. error Application.FileSearch.lookIn