XL5: DOCUMENTS() and WINDOWS() Return XL5GALRY.XLS FilenameLast reviewed: September 12, 1996Article ID: Q118602 |
The information in this article applies to:
SYMPTOMSIn Microsoft Excel, if you use the DOCUMENTS() or the WINDOWS() macro function to return a list of open documents or document windows, the filename XL5GALRY.XLS is returned in this list.
CAUSEThis behavior occurs if you have used the Options dialog box in the current session of Microsoft Excel. When you choose Options from the Tools menu, the file XL5GALRY.XLS is opened as a hidden file to access information about your default chart format. This file is not listed on the Window menu, and you cannot unhide this file. However, when you use the DOCUMENTS or the WINDOWS macro functions, the filename is returned as one of the currently open files or windows. The XL5GALRY.XLS file is located in your XLSTART directory. This behavior may cause a macro error, or unexpected macro results if your macro uses all of the returned filenames to manipulate each of the open files or windows.
WORKAROUNDSTo avoid returning XL5GALRY.XLS when you return a list of open documents, or open windows using a macro, use the Workbooks collection or the Windows collection in a Visual Basic procedure. The following are examples of using these methods: Microsoft provides examples of Visual Basic 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. This Visual Basic procedure is provided 'as is' and Microsoft does not guarantee that it can be used in all situations. Microsoft does not support modifications of this procedure to suit customer requirements for a particular purpose. Note that a line that is preceded by an apostrophe introduces a comment in the code--comments are provided to explain what the code is doing at a particular point in the procedure. Note also that an underscore character (_) indicates that code continues from one line to the next. You can type lines that contain this character as one logical line or you can divide the lines of code and include the line continuation character. For more information about Visual Basic for Applications programming style, see the "Programming Style in This Manual" section in the "Document Conventions" section of the "Visual Basic User's Guide."
Workbooks Collection
' Dimension wb as object type Dim wb as Object For each wb in Workbooks ' loop through each open Workbook and ' display the name in a message box MsgBox wb.Name Next Windows Collection
' Dimension w as object type Dim w as Object ' loop through each window on the Window menu and ' display the name in a message box For each w in Windows MsgBox w.caption Next STATUSMicrosoft has confirmed this to be a problem in the Microsoft products listed at the beginning of this article. This problem was corrected in Microsoft Excel for Windows version 5.0c.
MORE INFORMATIONYou can use the DOCUMENTS() function on a macro sheet to return the names of open workbooks to use in other functions that manipulate open workbooks. Similarly, you can use the WINDOWS() macro function to return a list of active windows to use with other macro functions to manipulate windows. The names returned by both of these functions are returned as a horizontal array of text values.
REFERENCESFor more information about WINDOWS, choose the Search button in the Microsoft Excel Macro Functions Help and type:
WINDOWS functionFor more information about DOCUMENTS, choose the Search button in the Microsoft Excel Macro Functions Help and type:
DOCUMENTS function |
KBCategory: kbprb
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |