Help and Support
 

powered byLive Search

Error message when you run a macro to search for a file in an Office 2007 program: "Run-time error 5111"

Article ID:920229
Last Review:February 18, 2008
Revision:2.0

SYMPTOMS

You run a Microsoft Visual Basic for Applications (VBA) macro in a Microsoft Office 2007 program to search for a file on your computer. When you do this, you may receive the following VBA error message:
"Run-time error 5111
The command is not available on this platform"

Back to the top

CAUSE

This issue occurs when you have 2007 Office programs installed on a Microsoft Windows XP computer, and the VBA macro uses the Application.FileSearch object. This object is no longer supported in 2007 Office programs.

Back to the top

WORKAROUND

To work around this issue, use the FileSystemObject object to recursively search directories and to find specific files. See the sample code that is provided in the following Microsoft Knowledge Base article:
185601 (http://support.microsoft.com/kb/185601/) How to recursively search directories by using filesystemobject

Back to the top

MORE INFORMATION

An alternative solution might be to script the Windows Desktop Search. For more information about this feature, visit the following Microsoft Web site:
http://www.microsoft.com/technet/scriptcenter/topics/desktop/wdsearch.mspx (http://www.microsoft.com/technet/scriptcenter/topics/desktop/wdsearch.mspx)

Back to the top


APPLIES TO
Microsoft Office Access 2007
Microsoft Office Excel 2007
Microsoft Office PowerPoint 2007
Microsoft Office Visio Professional 2007
Microsoft Office Visio Standard 2007
Microsoft Office Word 2007

Back to the top

Keywords: 
kberrmsg kbtshoot kbprogramming kbautomation kbprb kbexpertiseinter kbexpertisebeginner KB920229

Back to the top

Article Translations

 

Other Support Options

  • Need More Help?
    Contact a Support professional by Email, Online or Phone.
  • Customer Service
    For non-technical assistance with product purchases, subscriptions, online services, events, training courses, corporate sales, piracy issues, and more.
  • Newsgroups
    Pose a question to other users. Discussion groups and Forums about specific Microsoft products, technologies, and services.