XL5: Methods Fail When Embedded Chart Is EditedLast reviewed: September 12, 1996Article ID: Q111971 |
The information in this article applies to:
- Microsoft Excel for Windows, version 5.0
SUMMARYIn Microsoft Excel version 5.0, the following methods may fail if the active sheet is an embedded chart that is currently being edited and if an object is not specified for the method: - Charts Method (Syntax 2) - DialogSheets Method (Syntax 2) - Modules Method (Syntax 2) - Sheets Method (Syntax 2) - Worksheets Method (Syntax 2)
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 INFORMATIONEach of the above methods is used to return a collection of a particular type of sheet. For example, the Sheets method (Syntax 2) returns a collection that consists of all of the sheets in a workbook. If you do not include an object for each of the above methods, the object "ActiveWorkbook" is assumed for the method. For example, these two commands are equivalent:
ActiveWorkbook.Sheets.Count Sheets.CountBecause the ActiveWorkbook object is assumed for the second command, both commands return the number of sheets in the active workbook. However, if an embedded chart is currently being edited (that is, it is surrounded by a hatched diagonal border, or it is in its own window), the above methods may fail if an object is not explicitly included. For example, if an embedded chart is currently being edited and you use the command
Sheets.Countyou will receive the error message:
Run-time error '1004': Sheets method of Application class failedHowever, "ActiveWorkbook.Sheets.Count" will work properly even if an embedded chart is being edited. Explicitly including an object for each of the various methods will prevent the error from occurring.
WORKAROUNDTo prevent this type of error from occurring, include a specific object with the method. For example, instead of
Sheets.Countuse:
ActiveWorkbook.Sheets.Count -or- Workbooks("WORKBOOK.XLS").Sheets.CountEither of these workarounds will keep the error described above from occurring.
|
KBCategory: kbprb
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |