Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"Cannot insert object" error when adding ActiveX control like Microsoft DataGrid to Excel sheet [duplicate]

One of the users of our iGrid ActiveX grid control needs to insert it directly into an MS Excel sheet, but they have not managed to do that - the "Cannot insert object" error is generated all the time. We can also reproduce this problem on our test pc under Win7 64-bit and MS Office 2010 32-bit.

This COM control is properly registered in the OS and can be added to VBA UserForms and other apps, but we cannot do that for an Excel sheets. It seems, it's a common problem for ActiveX's - even legacy ones like Microsoft DataGrid Control 6.0. After searching for a solution for a significant amount of time, we concluded it is a security setting in MS Office. So the question can be formulated as the following: How to enable the usage of specific ActiveX controls in MS Office?

Below are the related resources we found and which might help.

First of all, Microsoft states that

Not all ActiveX controls can be used directly on worksheets; some can be used only on Microsoft Visual Basic for Applications (VBA) UserForms. When you work with these controls, Excel displays the message Cannot insert object if you try to add them to a worksheet.

Does anybody know what missing features might prevent an ActiveX control from being insertable into Excel sheets?

Second, there is a known issue with EXD files used to cache ActiveX controls. But we've checked - that's not our case.

Third, there are two technical articles from Microsoft which explain how to "fix" some ActiveX security problems for ActiveX's using the registry:

PRB: Error Message "Cannot insert object" in Excel
http://support.microsoft.com/default.aspx?scid=kb;EN-US;171280

Cannot insert certain scriptable ActiveX controls into Office 2013 documents
http://support.microsoft.com/kb/2793374

It seems, this also does not help - or we just did something wrong.

And the last thing we tried - the Office Trust Center. Allowing the usage of all ActiveX's without any restrictions and adding the folder with our iGrid ActiveX to the list of trusted location didn't help anyhow.

like image 937
TecMan Avatar asked Jun 03 '13 09:06

TecMan


3 Answers

From Technet Forum

Close Excel.

Start Windows Explorer.

Select your system drive (usually C:)

Use the Search box to search for *.exd

Delete all the files it finds.

Start Excel again.

like image 93
Stefan Michev Avatar answered Jan 04 '23 23:01

Stefan Michev


We have had a similar problem in the past with an ActiveX control that we insert on an Excel sheet from our COM Add-in, and you seem to have touched on two of the items (below) to solve it. The following solves the problem most* of the time.

From Excel 2010: File ribbon; Options; Trust Center; Trust Center Settings (button)...;

  • Add-ins: UNCHECK 'Require Application Add-ins to be signed by Trusted Publisher'.
  • Macro Settings: Ensure it is not disabling all Macros without notification. It is OK if it is set to 'Disable all Macros with notification'.
  • ActiveX Settings: Ensure it is not disabling all controls without notification. It is OK is it is set to 'Prompt me before enabling all controls with minimal restrictions'. THIS WAS THE MAIN CAUSE.
  • Trusted Locations: Add the directory of your control.

Note that some of these are usually not necessary if InstallShield properly registered the containing program (e.g. dll). Also notice that we still allow prompting (probably a good idea to pretect your liability). That has not caused us a problem.

  • However, the reason I am here is that we have one case (out of 200 customers) where the above did NOT work and this just started happening a week ago (it was working for the last 9 months). I am assuming Excel corruption at this point since there were no changes. We have otherwise tried everything. Did you resolve yours?
like image 38
F Watkin Avatar answered Jan 05 '23 00:01

F Watkin


This solved it for me:

Go to the following registry:

HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Office\15.0\Common\COM Compatibility{8856F961-340A-11D0-A96B-00C04FD705A2}

Then set the value data from 400 to 0.

Hope it helps.

Sorry forgot to give credit for the one who found it. Here. http://social.technet.microsoft.com/Forums/office/en-US/7942c472-2b5a-4005-888f-43ece2a5800a/adding-web-browser-control-to-excel-2013?forum=officeitpro&prof=required

like image 44
evo Avatar answered Jan 05 '23 01:01

evo