The information in this article applies to:
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:
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 INFORMATION
Each 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.
ActiveWorkbook.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: However, "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. Additional query words:
Keywords : |
Last Reviewed: October 6, 1999 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |