XL5: Methods Fail When Embedded Chart Is Edited |
In 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:
Microsoft 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.
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.
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.CountBecause the ActiveWorkbook object is assumed for the second command, both commands return the number of sheets in the active workbook.
Sheets.Count
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.Run-time error '1004':
Sheets method of Application class failed
To 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 :
Version : WINDOWS:5.0
Platform : WINDOWS
Issue type :
Technology :
|
Last Reviewed: October 6, 1999 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |