2

I am using Visual studio 2012 & creating a VB.Net Windows Forms Application whereas i am trying use microsoft office web components to embed an excel sheet into the form.

I have installed, Office web components 11. while selecting the Microsoft office spread sheet 11.0 Item it says following error

Failed to import the ActiveX control. Please ensure it is properly registered.

When i build it, it shows following error.

------ Rebuild All started: Project: WindowsApplication11, Configuration: Debug Any CPU ------
  COM Reference 'OWC11' is the interop assembly for ActiveX control 'AxOWC11' but was marked to be linked by the compiler with the /link flag. This COM reference will be treated as a reference and will not be linked.
C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(2015,5): warning MSB3284: Cannot get the file path for type library "7c0ffab0-cd84-11d0-949a-00a0c91110ed" version 1.0. Library not registered. (Exception from HRESULT: 0x8002801D (TYPE_E_LIBNOTREGISTERED))
C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(2015,5): error MSB3303: Could not resolve COM reference "0002e558-0000-0000-c000-000000000046" version 1.0. Object reference not set to an instance of an object.
C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(2015,5): warning MSB3284: Cannot get the file path for type library "7c0ffab0-cd84-11d0-949a-00a0c91110ed" version 1.0. Library not registered. (Exception from HRESULT: 0x8002801D (TYPE_E_LIBNOTREGISTERED))
C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(2015,5): error MSB3303: Could not resolve COM reference "0002e558-0000-0000-c000-000000000046" version 1.0. Object reference not set to an instance of an object.
========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ==========

PFB snapshot while dragging and dropping the Microsoft Spread sheet 11.0 item into the form enter image description here

Even i have tried registering manually, PFB .. But getting same error!

enter image description here Please tell me whats the problem and how to resolve it ?

Martijn Pieters
  • 1,048,767
  • 296
  • 4,058
  • 3,343
logan
  • 7,946
  • 36
  • 114
  • 185
  • The error-messages clearly state the problem is that the COM/ActiveX library is not registered. Have you tried re-registering the library? – Dai Dec 30 '13 at 08:38
  • @Dai : could you please tell me how to re-register it ? – logan Dec 30 '13 at 08:41
  • This page will help http://ss64.com/nt/regsvr32.html but I don't know what the filename is. Also make sure you're building a 32-bit EXE, not AnyCPU or x64 unless you're using the 64-bit Office 2010/2013 components. – Dai Dec 30 '13 at 08:46
  • @Dai : I am using 64bit only – logan Dec 30 '13 at 10:29
  • I also unaware of DLL_Name to be supplied ! any suggestion ? – logan Dec 30 '13 at 12:57
  • @logan This error **might** be thrown due to bad registry keys. Check this post, [Outlook 2007 from C# - COM exception, TYPE_E_LIBNOTREGISTERED](http://stackoverflow.com/questions/2347529/outlook-2007-from-c-sharp-com-exception-type-e-libnotregistered). Notice the same COM exception. It's worth looking into. – Bjørn-Roger Kringsjå Jan 04 '14 at 20:48
  • @logan it seems that a lot of the legacy ActiveX objects aren't supported in 64-bit applications (http://social.msdn.microsoft.com/Forums/office/en-US/92f0df87-b6a1-48ad-99ea-90ce79ef0a7e/using-owc11dll-spreadsheet-control-in-64-bit-office-vba). – sous2817 Jan 05 '14 at 18:50

6 Answers6

4

OPen CMD and write :

REGSVR32 YouDllName.dll

if you get error message :

Filename.dll is not an executable file and no registration helper is registered for this file type. 

Use this command :

cd \windows\syswow64
regsvr32 c:\YouDllName.dll path for the dll file.

UPDATE: The file is named owc11.dll, and its default location is

C:\Program Files\Common Files\Microsoft Shared\Web Components\11

or, if you have 64-bit Windows:

C:\Program Files (x86)\Common Files\Microsoft Shared\Web Components\11

Al-3sli
  • 2,161
  • 2
  • 15
  • 19
  • what is YouDllName.dll ? where is it located ? – logan Dec 30 '13 at 11:11
  • I mean your DLL file name the one you want to register – Al-3sli Dec 30 '13 at 12:11
  • I don't know what is dll file name for visual studio ? – logan Dec 30 '13 at 12:21
  • I update my comment check it please. Hope this help. – Al-3sli Dec 30 '13 at 20:09
  • When i tried registering manually, i am getting error. Please see the latest snapshot attached to the question – logan Dec 31 '13 at 07:23
  • This is permission issue , `**RUN CMD as Administrator**` – Al-3sli Dec 31 '13 at 07:26
  • I tried with administrator, this time different error. please see updated snapshot.. – logan Dec 31 '13 at 07:31
  • let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/44211/discussion-between-logan-and-al-3sli) – logan Dec 31 '13 at 07:32
  • @Al-2sli : I have executed the cmd line successfully(PFA updated snapshot in question). **BUT Still the same problem persists!!** kindly suggest any help – logan Jan 02 '14 at 06:20
  • do this step : 1- delete AppFolder\Obj\Debug content. 2- remove the tool from your toolbox. 3- use this command : `aximp C:\Program Files (x86)\Common Files\Microsoft Shared\Web Components\11\owc11.dll`. 4- now add it to your Toolbox and drag it to your form. – Al-3sli Jan 02 '14 at 07:36
  • do you mean following folder ? please confirm. **\Documents\Visual Studio 2012\Projects\WindowsApplication7\WindowsApplication7\obj\Debug** – logan Jan 02 '14 at 07:53
  • it is saying **aximp is not recognized as an internal or external command, operable program or batch file. ** – logan Jan 02 '14 at 08:00
  • AxImp.exe can be found in the Windows SDK (ie, C:\Program Files\Microsoft SDKs\Windows\v6.0A\Bin\AxImp.exe). – Al-3sli Jan 02 '14 at 08:05
  • let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/44303/discussion-between-logan-and-al-3sli) – logan Jan 02 '14 at 08:10
  • Still same problem .. Same error : Error 2 Could not resolve COM reference "0002e558-0000-0000-c000-000000000046" version 1.0. Object reference not set to an instance of an object. WindowsApplication21 Error 4 Could not resolve COM reference "0002e558-0000-0000-c000-000000000046" version 1.0. Object reference not set to an instance of an object. WindowsApplication21 Warning 5 The referenced component 'OWC11' could not be found. WindowsApplication21 – logan Jan 02 '14 at 09:18
  • Warning 6 The referenced component 'AxOWC11' could not be found. WindowsApplication21 Error 7 Unable to open file 'c:\users\lpalani\documents\visual studio 2012\Projects\WindowsApplication21\WindowsApplication21\obj\Debug\WindowsApplication21.Form1.resources': The system cannot find the file specified. Error 8 Unable to open file 'c:\users\lpalani\documents\visual studio 2012\Projects\WindowsApplication21\WindowsApplication21\obj\Debug\WindowsApplication21.Resources.resources': The system cannot find the file specified. – logan Jan 02 '14 at 09:19
  • No ! still unlucky ! Contacted Microsoft – logan Jan 04 '14 at 18:36
  • I give you 50 bounty for your effort to research ! Thanks. Please see my solution – logan Jan 06 '14 at 11:32
  • I'm sure this won't get a reply due to the thread age, but I have a similar problem. I managed to create the AxOWC11.dll file and locate it in VBA, but VBA doesn't seem to support the dll, saying "Can't add a reference to the specified file" – Andres Salas Jul 23 '18 at 18:31
1

I got an answer from Microsoft Team! Here is it...

Office Web Components is a deprecated technology and is no longer under active development. Hence we advise you to move to Excel services from OWC. This is documented in below articles

http://blogs.office.com/b/microsoft-excel/archive/2006/07/17/office-web-components-roadmap.aspx

logan
  • 7,946
  • 36
  • 114
  • 185
1

please visit this address. I am not able to understand their tech words, but the buttom line is that the OWC will no longer run with the office.

http://blogs.office.com/2006/07/17/office-web-components-roadmap/

Yavuz
  • 11
  • 1
0

In some exoteric case, the key {91A74EB0-EFA0-482B-B43C-35CFC74B275F} can not be deleted. In these cases do the following:

1) Use the utility tool RunAsSystem

https://www.raymond.cc/blog/full-control-permission-to-delete-or-edit-restricted-windows-registry/

2) Delete the key {91A74EB0-EFA0-482B-B43C-35CFC74B275F}

3) Be Happy :-)

0

I got the same problem. This is my coding environment by following: VB2008/ Win7 SP1/ IE10/ OWC11

I got this problem when I upgrade IE from 8 to 10.

My solution is that starts VB with administrator. Then, add the OWC11 component again. Right click on your mouse on the toolbox to click "selecting items". Next, go into COM page, then go to the place where OWC11.DLL originally is placed, re-add it. Finally, the problem will be solved. Try it.

In my case, OWC11.dll is located at C:\Program Files (x86)\Common Files\Microsoft Shared\Web Components\11\owc11.dll

C.K
  • 1
-1

Ok here is my Solution:

After you add it to ToolBox, Drag and Drop it in your Windows Form... The error will raise.. click Ok..

Rebuil Your Project (The DLL will be copied)

Re-Drag and Drop the component and now, it'll work

Check this out

Pouya Samie
  • 3,718
  • 1
  • 21
  • 34
  • where the dll will be copied when i rebuild it ? because i have already tried rebuild it & done drag and drop. it did not work. – logan Dec 30 '13 at 13:30
  • while rebuilding only , i got the errors said in question. please check – logan Dec 31 '13 at 07:32
  • I told you first drag and drop then when u got the error click ok then rebuild then drag and drop again – Pouya Samie Dec 31 '13 at 10:10