XL97: Cannot Get OLEObjects Property Referencing Collection

Last reviewed: March 13, 1998
Article ID: Q157280
The information in this article applies to:
  • Microsoft Excel 97 for Windows

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 name> property of the <class name> 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 this to be a problem in the Microsoft products listed at the beginning of this article. We are researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available.


Additional query words: XL97 8.00 interior patterncolor color
Keywords : kbcode kbprg xlvbainfo
Version : WINDOWS:97
Platform : WINDOWS


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: March 13, 1998
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.