Microsoft KB Archive/157349

{| = XL97: Can't Access File List and Window List Menu Items =
 * width="100%"|

Last reviewed: September 3, 1997

Article ID: Q157349 The information in this article applies to:
 * Microsoft Excel 97 for Windows

SYMPTOMS
In Microsoft Excel 97, if you use a Visual Basic for Applications macro to work with the File List menu item (on the File menu), or the Window List menu item (on the Window menu), your macro may fail with the error message:

Run-time error '1004': Application-defined or object-defined error

CAUSE
It is not possible to work with the File List or Window List menu items in Microsoft Excel 97.

RESOLUTION
This error will occur if you use either of the following code segments within a Visual Basic for Applications macro:

Menus("File").MenuItems("File List")

-or-

Menus("Window").MenuItems("Window List") You cannot Delete or get the Index of these menu items in Microsoft Excel 97.

STATUS
Microsoft has confirmed this to be a problem in the Microsoft products listed at the beginning of this article. We are researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available.

MORE INFORMATION
Microsoft provides examples of Visual Basic for Applications procedures for illustration only, without warranty either expressed or implied, including, but not limited to the implied warranties of merchantability and/or fitness for a particular purpose. The Visual Basic procedures in this article are provided 'as is' and Microsoft does not guarantee that they can be used in all situations. While Microsoft support engineers can help explain the functionality of a particular macro, they will not modify these examples to provide added functionality, nor will they help you construct macros to meet your specific needs. If you have limited programming experience, you may want to consult one of the Microsoft Solution Providers. Solution Providers offer a wide range of fee-based services, including creating custom macros. For more information about Microsoft Solution Providers, call Microsoft Customer Information Service at (800) 426-9400.

In Microsoft Excel, the File List menu item is used to display the list of most-recently used (MRU) files at the bottom of the File menu. The Window List menu item is used to display the list of the open windows in Microsoft Excel at the bottom of the Window menu.

In earlier versions of Microsoft Excel, you can use a Visual Basic macro to display the index of these menu items (by using the Index property) or delete these menu items (by using the Delete method). For example, the following macro will show the Index of the File List menu item:

Sub ShowFileListIndex x = MenuBars("Worksheet").Menus("File").MenuItems("File List").Index MsgBox x  End Sub This macro works in Microsoft Excel versions 5.0 and 7.0; it fails in Microsoft Excel 97.
 * }