Microsoft KB Archive/157280

= XL97: Cannot Get OLEObjects Property Referencing Collection =

Article ID: 157280

Article Last Modified on 10/10/2006

-

APPLIES TO


 * Microsoft Excel 97 Standard Edition

-



This article was previously published under Q157280





SYMPTOMS
When you attempt to get a property of an ActiveX control using the OLEObjects method, you may receive the following error:

Run-time error '1004':

Unable to get the property of the class.

For example, running a macro containing this statement x = Sheet1.OLEObjects.Border.ColorIndex should return the ColorIndex property of the Border class, but the following error message appears:

Run-time error '1004':

Unable to get the ColorIndex property of the Border class.



WORKAROUND
To work around this problem, refer to the index number of the ActiveX control. Instead of referring to the OLEObjects collection, refer to a single OLEObject. For the example above, use the following statement to return the ColorIndex property of the Border class: x = Sheet1.OLEObjects(1).Border.ColorIndex



STATUS
Microsoft has confirmed that this is a problem in the Microsoft products that are listed at the beginning of this article.

Additional query words: XL97 8.00 interior patterncolor color Run-time error 1004

Keywords: kbbug kbdtacode kberrmsg kbpending kbprogramming KB157280

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.