PRB: "Cannot insert object" in Excel97

Last reviewed: July 11, 1997
Article ID: Q171280
The information in this article applies to:
  • Microsoft Visual C++, 32-bit Editions, version 5.0
  • Microsoft Excel 97 for Windows

SYMPTOMS

The error message, "Cannot insert object", appears when you attempt to use your Visual C++ control in Microsoft Excel 97.

CAUSE

This error occurs if you created a control in Visual C++, manually changed the _wVerMajor and/or _wVerMinor variables, and didn't change the corresponding type library version number in the .odl file of your project. This occurs because Microsoft Excel 97 explicitly checks to see if these two variables are equivalent in the registry.

RESOLUTION

To resolve this problem, you either have to change the version() attribute in your .odl file to reflect the current state of the _wVerMajor and _wVerMinor variables at compile-time, or specifically modify the registry entry HKCR\TypeLib\<Your TypeLib>\X.Y, where X and Y represent your major and minor version numbers respectively.

STATUS

This behavior is by design.

MORE INFORMATION

Steps to Reproduce Behavior

  1. Create a new MFC ActiveX ControlWizard project, and click Finish.

  2. Open your <ProjectName>.cpp file, and find the variables _wVerMajor and _wVerMinor.

  3. Change the _wVerMajor variable to 3.

  4. Compile the project.

  5. Open Microsoft Excel 97.

  6. Try to insert your control using the Object option under the Insert menu.

  7. The "Cannot insert object" error message appears.

REFERENCES

For more information about the wVerMajor or wVerMinor global constants, search for "wVerMajor" or "wVerMinor" in Visual C++ Help.

For more information about ODL (Object Description Language) files and the version() attribute, search for "ODL" or "ODL Attributes" in Visual C++ Help.

Technology          : kbole
Version             : 97 5.0
Platform            : NT WINDOWS
Issue type          : kbprb


================================================================================


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: July 11, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.