Skip navigation.

Blog

COMException "Class not registered" on 64-bit Windows

Having finally got myself running live on Windows 7, this morning it was time to fix the one problem remaining - Visual Studio 2008 throwing the COMException "Class not registered" (REGDB_E_CLASSNOTREG) when trying to call InitializeComponent on a form which has an ActiveX control on it:

System.Runtime.InteropServices.COMException (0x80040154): Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG))
   at System.Windows.Forms.UnsafeNativeMethods.CoCreateInstance(Guid& clsid, Object punkOuter, Int32 context, Guid& iid)
   at System.Windows.Forms.AxHost.CreateWithoutLicense(Guid clsid)
   at System.Windows.Forms.AxHost.CreateWithLicense(String license, Guid clsid)
   at System.Windows.Forms.AxHost.CreateInstanceCore(Guid clsid)
   at System.Windows.Forms.AxHost.CreateInstance()
   at System.Windows.Forms.AxHost.GetOcxCreate()
   at System.Windows.Forms.AxHost.TransitionUpTo(Int32 state)
   at System.Windows.Forms.AxHost.CreateHandle()
   at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
   at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
   at System.Windows.Forms.AxHost.EndInit()
   at OCXWrappers.TXTextControl.InitializeComponent() in C:\Users\...\Form1.Designer.vb:line 42

Hunting around Google turned up nothing (the OCX was definately registered correctly), but I did twig after a few minutes... The ActiveX control in question was 32-bit, whereas Visual Studio defaults to compile to "Any CPU" and I was now running 64-bit Windows.

Solution: Go into the Project Properties, Compile tab and click "Advanced Compile Options...". Change "Target CPU" to x86, click OK, save and try again.

Presumably this is the same problem as others have had when trying to run on Windows XP / Server 2003 and above when the customer is running 64-bit and the development environment is 32-bit.

By on October 5, 2009 | Permalink | Comment


Reader Comments

Skip to form

January 14, 2010, Andy Bruce says:

Yup, that was my problem too. Freaking annoying it is, too! After all this time to have to think about COM and 32-bit code, ugh.

February 17, 2010, Mark Beckwith says:

I am on my knees thanking God for Theo Gray. Also cursing MS a little bit.

February 22, 2010, Bob says:

Thanks Very Much for this, its appreciated !!

February 24, 2010, Nick Olsen says:

Thanks for this! Solved my problem! [pingback]

May 2, 2010, johany says:

thanks

you solved it nice and easy

May 10, 2010, Mark says:

Holy cow, I spent a number of hours on this. Thanks so much!

May 27, 2010, Faraday says:

Thank you, this solved my problem.

July 1, 2010, Vinu nair says:

thank you very much, @ the end of the day I am happy that the issue is sorted out.

November 12, 2010, JFinger says:

Thank you, thank you, thank you.
"Any CPU" was all over the place, and I had a 32-bit ActiveX control on a Windows Form (VS2005 C#) and needed this code to go on both 32-bit and 64-bit platforms. The x86 did the trick, although I am peeved that it created a whole new configuration in VS2005, but I can deal with it because it finally works!!! Thank you again!!!

February 17, 2011, Bruce says:

You just ended hours and hours of frustration!! Thanks!!!

April 28, 2011, amit patil says:

Hi,
I m using VSTA 2 ( Visual studio tools for applications ) and having the same problem.
As per your solution i need to change target platform, but there is no option to change target platform in VSTA.
Your help appreciated.
Amit

May 17, 2011, Robbo says:

Hi,

I have VB.NET VS2008 and VS2010 and I cannot find any reference to TargetCPU in the advanced compile options. Is this because I only have the Express editions?

I cannot use an ocx on Win 7 64 bit even though it has been successfully registered using sysWow64\regsvr32.exe.

Any suggestions please?

May 17, 2011, Robbo says:

Hi again,
I found the answer to my question here:
http://forums.create.msdn.com/forums/t/4377.aspx#22601


  1. In VS Express 2005/8/10 VB Net or C", go to Tools -> Options.

  2. In the bottom-left corner of the Options dialog, check the box that says, "Show all settings".

  3. In the tree-view on the left hand side, select "Projects and Solutions".

  4. In the options on the right, check the box that says, "Show advanced build configurations."

  5. Click OK.

  6. Go to Build -> Configuration Manager...

  7. In the Platform column next to your project, click the combobox and select "".

  8. In the "New platform" setting, choose "x86".

  9. Click OK.

  10. Click Close

July 20, 2011, Dirk Bondy says:

Thank you!!! This has been driving me insane for two days. You solved it.

August 16, 2011, nidheesh says:

We developed one windows application using VS 2005 with framework 2.0. This application is running perfectly on 32 bit Operating System. Now we need to give support for 64 bit OS.

While working with 64 bit Operating System we are getting the below error message.

"Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG))".

Following is the code block

System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Driver));
this.axDriver = new AxCCNAccess.AxDriver();
((System.ComponentModel.ISupportInitialize)(axDriver)).BeginInit();
SuspendLayout();
 
// 
// axDriver
// 
axDriver.Enabled = true;
axDriver.Location = new System.Drawing.Point(241, 211);
axDriver.Name = "axDriver ";
axDriver.OcxState = ((System.Windows.Forms.AxHost.State)(resources.GetObject("axDriver.OcxState")));
axDriver.Size = new System.Drawing.Size(41, 42);
axDriver.TabIndex = 0;
 
// 
// Driver
// 
AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
ClientSize = new System.Drawing.Size(292, 266);
Controls.Add(axDriver );
Name = "DriverContainer";
Text = "DriverContainer";
 
try
{
    ((System.ComponentModel.ISupportInitialize)(axDriver )).EndInit();
}
catch (Exception ex)
{
    string sss = ex.Message;
}
 
ResumeLayout(false);

Getting issue in the try block.

Please help

i tried changing the compile options. but didnt worked out for me

Regards,
Nidheesh

August 31, 2011, Oscar P says:

It worked for me. I was compiling in a Win 7 64 and the .exe was not working on other PCs, but not anymore. THANKS.

September 1, 2011, Jose Luis Torres C says:

Thanks a lot!!!!, you save my life with this problem, I spent a lot of time trying to figureout!!!!.

September 8, 2011, your fan says:

Many many thanks! you are god!

October 11, 2011, majesty says:

it work... thank's...

October 13, 2011, DerekCoder says:

Thanks for the great info. You just saved me some valuable time.

November 19, 2011, Alireza says:

Really thanks
I was going to reinstall whole system , but now it is solved

December 2, 2011, Kai says:

Thank you,
now I can start enjoying my weekend.

December 8, 2011, VJ says:

Theo gray. Thanks a tonne. You saved a hell of a time.
Cheers.

December 11, 2011, Filip Z. says:

YOU ARE A GOD !!!!!!!!
You have no idea how many days I spent trapping errors, reading blogs, taking suggestions, trying almost everything possible anyone ever suggested, only your solution worked for me !!!

December 16, 2011, Roby says:

Thanks to all!!

January 13, 2012, Prasad says:

My development environment is XP32bit & client is tested on win764bit. Though i have created installer with the Release-X86 option, client is getting the AXHOST issue. please advice

January 13, 2012, Theo Gray says:

@Prasad The error is caused by the ActiveX control registration information not being found, so in the case of an x64 app, this is because the registration info is x86 based. In your case, have you checked that the ActiveX control is definitely registered on the client machine?

February 9, 2012, Vinay says:

The following steps i have applied in OS Windows 7 and VS 2010. But I am getting same error.

//************************
1. In VS Express 2005/8/10 VB Net or C", go to Tools -> Options.

2. In the bottom-left corner of the Options dialog, check the box that says, "Show all settings".

3. In the tree-view on the left hand side, select "Projects and Solutions".

4. In the options on the right, check the box that says, "Show advanced build configurations."

5. Click OK.

6. Go to Build -> Configuration Manager...

7. In the Platform column next to your project, click the combobox and select "".

8. In the "New platform" setting, choose "x86".

9. Click OK.

10. Click Close
//************************

February 10, 2012, Michael says:

You saved me a lot of time. Thanks!

July 10, 2012, Dinuka says:

Thanks.. it works...

August 23, 2012, Pradeeba says:

I tried changing the configuration manager settings to x86, but still it didnt work for me....



***************************

Go into the Project Properties, Compile tab and click "Advanced Compile Options...". Change "Target CPU" to x86, click OK, save and try again.


**************************
In VS Express 2005/8/10 VB Net or C", go to Tools -> Options.

In the bottom-left corner of the Options dialog, check the box that says, "Show all settings".

In the tree-view on the left hand side, select "Projects and Solutions".

In the options on the right, check the box that says, "Show advanced build configurations."

Click OK.

Go to Build -> Configuration Manager...

In the Platform column next to your project, click the combobox and select "".

In the "New platform" setting, choose "x86".

Click OK.

Click Close

***************************

August 23, 2012, Pradeeba says:

Now the error changed from the below to ..... "Method 'LoadFile' cannot be invoked at this time."

********

System.Runtime.InteropServices.COMException (0x80004005): Error HRESULT E_FAIL has been returned from a call to a COM component.
   at System.Windows.Forms.UnsafeNativeMethods.CoCreateInstance(Guid& clsid, Object punkOuter, Int32 context, Guid& iid)
   at System.Windows.Forms.AxHost.CreateWithLicense(String license, Guid clsid)
   at System.Windows.Forms.AxHost.CreateInstanceCore(Guid clsid)
   at System.Windows.Forms.AxHost.CreateInstance()
   at System.Windows.Forms.AxHost.GetOcxCreate()
   at System.Windows.Forms.AxHost.TransitionUpTo(Int32 state)
   at System.Windows.Forms.AxHost.CreateHandle()
   at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
   at System.Windows.Forms.Control.CreateControl()
   at System.Windows.Forms.Control.ControlCollection.Add(Control value)
   at System.Windows.Forms.Form.ControlCollection.Add(Control value)
   at SampleReporting.frmDisplayResult.InitializeAdobe(String filePath) in C:\TEMP\SampleReporting24052012\std\pbefficiency\samplereporting\trunk\src\SampleReporting\SampleReporting\frmDisplayResult.cs:line 85

**************************

In VS Express 2005/8/10 VB Net or C", go to Tools -> Options.

In the bottom-left corner of the Options dialog, check the box that says, "Show all settings".

In the tree-view on the left hand side, select "Projects and Solutions".

In the options on the right, check the box that says, "Show advanced build configurations."

Click OK.

Go to Build -> Configuration Manager...

In the Platform column next to your project, click the combobox and select "".

In the "New platform" setting, choose "x86".

Click OK.

Click Close

***************************

August 29, 2012, Pradeeba says:

Solution to my problem is that Adobe has to be registered on registry of the machine from which it is executing...

October 17, 2012, ankit says:

I have change the build option from the Project properties option to x86 but it is still showing me the same error.Please help me out

November 16, 2012, Ocram says:

I need help, please!
I fixed this problem 2 months ago, and now it is back. I spent the week checking and double checking that every setting in the Project Properties is x86... I also changed the .Net Framework to 3.0 (x86) instead of 3.5. Using VS2008-C#
I have isolated the problem to be in the initialization of the AxAcroPDFLib.AxAcroPDF object.

Thanks in advanced!

December 7, 2012, Krishnanand says:

I can't explain in words what you did for me..It was just more than frustrating and you gave a ray of hope

Thanks and thank you very much


keep posting for tough issues :)

January 23, 2013, Liam says:

Thanks buddy. This saved my project. I was messing around with some new API and for the life of me couldn't figure out why I kept getting this error

February 8, 2013, kapil says:

I tried "New platform >>, choose "x86" setting working for win 7 (64 bits) but not for win 7 (32 bits) version please help!!!

April 15, 2013, samtal says:

I have a VS2010 Express installed as X86 on Win7-64 machine.

I used to load and save Excel files using the free ExcellLibrary that was easy to use and worked perfect (and need no Excel installed!).

As that ExcelLibrary does not support xlsx, I switched to Microsoft's Excel Interop (significantly more complex, and need running Excel on both machines!), and I keep getting the "Retrieving the COM class factory for component with CLSID failed due to the following error: 80040154 Class not registered" error.

Following lots of googling, I managed to change the Solution Platform to X86, but still have the same error that drives me nuts.

My code Snippet (short form)

using Excel = Microsoft.Office.Interop.Excel;
using Microsoft.Office.Interop.Excel; 

Microsoft.Office.Interop.Excel.Application appExl;
     ExcelReaderInterop excelreader = new ExcelReaderInterop();
        Excel.Application appExl;
        Workbook workbook = new Workbook(); <-This is where the error is!

Please HELP!!

April 16, 2013, Theo Gray says:

@samtal have you checked whether you have 32-bit or 64-bit Office installed?

April 16, 2013, samtal says:

I purchased on-line and installed recently Office2013 which I assumed was 64 bit. (Win7 64 machine)
I checked now and found out it is 15.0.4454.1523 32 bit.
Does this make a difference?

April 16, 2013, Theo Gray says:

@samtal If you are definately compiling your application as 32-bit (x86) then there is a possibility that 64-bit Office would fail, but you have 32-bit Office so all should be fine.

Do you get the same error on the same line of code on both machines or is it just one machine that errors?

July 2, 2013, vimal says:

Retrieving the COM class factory for component with CLSID {07C125F2-0E5A-11D3-B339-00A0C9B04E87} failed due to the following error: 80040154 Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG))

please help..!

July 3, 2013, Umair says:

 at System.Windows.Forms.UnsafeNativeMethods.CoCreateInstance(Guid& clsid, Object punkOuter, Int32 context, Guid& iid)
   at System.Windows.Forms.AxHost.CreateWithoutLicense(Guid clsid)
   at System.Windows.Forms.AxHost.CreateWithLicense(String license, Guid clsid)
   at System.Windows.Forms.AxHost.CreateInstanceCore(Guid clsid)
   at System.Windows.Forms.AxHost.CreateInstance()
   at System.Windows.Forms.AxHost.GetOcxCreate()
   at System.Windows.Forms.AxHost.TransitionUpTo(Int32 state)
   at System.Windows.Forms.AxHost.CreateHandle()
   at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
   at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
   at System.Windows.Forms.AxHost.EndInit()
   at EMRMain.ucNewDocuments.InitializeComponent() in C:\Work\Work2012\NortecEHR\EMRMain\Dashboard\ucNewDocuments.Designer.cs:line 341
   at EMRMain.ucNewDocuments..ctor() in C:\Work\Work2012\NortecEHR\EMRMain\Dashboard\ucNewDocuments.cs:line 29
   at EMRMain.ucDashBoard.InitializeForm() in C:\Work\Work2012\NortecEHR\EMRMain\Dashboard\ucDashBoard.cs:line 77

i have same issue but my requirement is that i have to run my application on 64 bit . dont want to compile on 32 bit . so is there any way ?

or alternate of this dll ?

July 4, 2013, Eren says:

I developed a camera integration to my Windows application. When i tried to run my app i was getting this error. In my case when i installed sdk of camera integration tool my problem was solved. Installing sdk made my dlls registered to server i think.

October 3, 2013, Nadun says:

Thank you very much for sharing this solution.. worked perfectly :)

February 13, 2014, Delwar Hossain says:

Thanks man! Changing- Build> target compile platform to x86 solved the freaking problem!!

February 18, 2014, matty s says:

Hi,
I am trying to run a computer based training program designed by avsoft. When I open the file and try to click on the links inside i get the above error message. Unfortunately, I do not understand the above messages. Is someone able to give me a step by step instruction of changing my computer settings if that is what is required? TIA

February 18, 2014, Theo Gray says:

Hello @matty,
You should contact AVSoft to get them to fix the problem, or see if they have a newer version which is compiled correctly.

March 12, 2014, Sue says:

Thank you!!!!!!!

April 21, 2014, Noman hussain says:

Thanks it solved my prob.

April 23, 2014, John Mott says:

5 years later and this post is saving lives! I had an old control that I had wrapped a bunch of really critical code around and I was close to despair on Windows 8.

April 27, 2014, maheshbhai machhar says:

msg 30 error no 429 icupon pds ma clas not regt ave che?

May 21, 2014, amol rathod says:

I am getting this error while connecting QC(Quality Centre) using JAVA.

com4j.ComException: 80040154 Class not registered : Class not registered : .\invoke.cpp:517
	at com4j.Wrapper.invoke(Wrapper.java:166)
	at com.sun.proxy.$Proxy10.initConnectionEx(Unknown Source)
	at library.DefectDetailsDriver.RaiseDefect(DefectDetailsDriver.java:168)
	at testscripts.QC_Integration_Demo.tearDown(QC_Integration_Demo.java:37)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Unknown Source)
	at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:84)
	at org.testng.internal.Invoker.invokeConfigurationMethod(Invoker.java:564)
	at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:213)
	at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:138)
	at org.testng.internal.TestMethodWorker.invokeAfterClassMethods(TestMethodWorker.java:225)
	at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:114)
	at org.testng.TestRunner.privateRun(TestRunner.java:767)
	at org.testng.TestRunner.run(TestRunner.java:617)
	at org.testng.SuiteRunner.runTest(SuiteRunner.java:334)
	at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:329)
	at org.testng.SuiteRunner.privateRun(SuiteRunner.java:291)
	at org.testng.SuiteRunner.run(SuiteRunner.java:240)
	at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
	at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
	at org.testng.TestNG.runSuitesSequentially(TestNG.java:1224)
	at org.testng.TestNG.runSuitesLocally(TestNG.java:1149)
	at org.testng.TestNG.run(TestNG.java:1057)
	at org.testng.remote.RemoteTestNG.run(RemoteTestNG.java:111)
	at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:204)
	at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:175)
Caused by: com4j.ComException: 80040154 Class not registered : Class not registered : .\invoke.cpp:517
	at com4j.Native.invoke(Native Method)
	at com4j.StandardComMethod.invoke(StandardComMethod.java:35)
	at com4j.Wrapper$InvocationThunk.call(Wrapper.java:340)
	at com4j.Task.invoke(Task.java:51)
	at com4j.ComThread.run0(ComThread.java:153)
	at com4j.ComThread.run(ComThread.java:134)

August 10, 2014, Joe K. says:

Thank You!

August 27, 2014, Bob Hoyng says:

Another thank you...lost several hours to this before I came across this post. I normally develop in VB6 but use VB2005 or beyond for in-house applications when needed and just tried to migrate one of those in-house apps from a 32-bit to a 64-bit server. I don't think it would have happened without this post. :)

August 27, 2014, Chris Burgener says:

Thank you so much for this! I spent at least two days on this issue with a program that no one updated for years, and it turned out to be such a simple fix!

September 4, 2014, Sabyasachi Bera says:

Thanks a lot..it saved lot of time.

October 9, 2014, Greg Woods says:

5 ears after writing this post, it helped me out!
I'd got a .NET project working using Framework 4.5 and an old COM dll. I didn't have to change my .NET project to x86.

However, when I recompiled using .NET Framework 4.0, I started getting the COMException "Class not registered" error.
Changing the project to target x86 fixed it.

Thank you

December 23, 2014, Neil Moss says:

5 years on, and still helping. Thanks.

February 26, 2015, Garwin says:

Thank you!

March 5, 2015, Amir says:

Dear Theo

I am trying to make communication between matlab and another software (DSATools). There is a .bin file as a output of DSATools and I need to read it by matlab. According to the manuals of that software, I should start my commands with actxserver as follow:

r=actxserver('ResultScript.BinReader');

but the following errors will appeare in command windows of matlab:

************
Error using feval
Server Creation Failed: Class not registered

Error in actxserver (line 86)
        h=feval(['COM.' convertedProgID], 'server', machinename, interface);
************

As I checked in the folders of DSATools, there is a ResultScript.dll file in there.

My OS is windows 8-64bit & My matlab is R2014a-64bit & DSATools is working with any version of windows 64 and 32 ( As I heard :-) ).

Would you please help me to find out that what is the problem? And IS there any solution or not?

ThX

March 30, 2015, Bharat says:

Dear Theo,

I feel relived when i saw the solution to the error. Thanks for such wonderful art of work and sharing the same on ur blog.

Though i am not able to apply the solution anywhere, as i am using Windows Server 2008 R2, but the problem arised due to an upgrade in software for the time and attendance purpose.
At first it was working fine but then i restarted the application i started getting the error and i am not able to download the log files of the entries happened in the biometric device.

Please need your support on the same.

Thanks,
Bharat..

April 28, 2015, Naresh says:

Hi Theo,
I have a problem of connecting to TFS 2008. It says 'retrieving the com class factory for component with clsid {} failed due to the following error: 80040154 class not registered'

However it connects to source control and could not connect to builds and other things.

Can you please help me here.

Regards
Naresh

May 11, 2015, Alma Varela says:

Thank you so much

May 22, 2015, Zia says:

thank you very much, @ the end of the day I am happy that the issue is sorted out.

July 7, 2015, Asif Iqbal says:

Thank you so much. You saved my life :)

August 14, 2015, Sathishkumar says:

Thanks a lot. :-)

August 16, 2015, Dev says:

THANK YOU!!!

September 8, 2015, Wahid says:

The solution for my problem as below,

1. I have a 32 bit third party dll which i have installed in 2008 R2 machine which is 64 bit.
2. I have a wcf service created in .net 4.5 framework which calls the 32 bit third party dll for process. Now i have build property set to target 'any' cpu and deployed it to the 64 bit machine.
3. when i tried to invoke the wcf service got error "80040154 Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG"
4. Now i used ProcMon.exe to trace the com registry issue and identified that the process is looking for the registry entry at HKLM\CLSID and HKCR\CLSID where there is no entry.
5. Came to know that Microsoft will not register the 32 bit com components to the paths HKLM\CLSID, HKCR\CLSID in 64 bit machine rather it places the entry in HKLM\Wow6432Node\CLSID and HKCR\Wow6432Node\CLSID paths.
6. Now the conflict is 64 bit process trying to invoke 32 bit process in 64 bit machine which will look for the registry entry in HKLM\CLSID, HKCR\CLSID. The solution is we have to force the 64 bit process to look at the registry entry at HKLM\Wow6432Node\CLSID and HKCR\Wow6432Node\CLSID.
7. This can be achieved by configuring the wcf service project properties to target to 'X86' machine instead of 'Any'.
8. After deploying the 'X86' version to the 2008 R2 server got the issue "System.BadImageFormatException: Could not load file or assembly"
9. Solution to this badimageformatexception is setting the 'Enable32bitApplications' to 'True' in IIS Apppool properties for the right apppool.

September 13, 2015, Christian says:

Thanks so much!!

January 30, 2016, Mefi-Boset Navarro says:

Thanks man... 2016 and your advice still works!!!

March 10, 2016, AG says:

Nice. Thank you very much... It works..:-)

July 2, 2016, Mehul says:


In my case client's system windows xp mine is windows 8(64bit).
Great thanks No words.
Your advice saved me.

July 5, 2016, karthi says:

hi.. i got the same error in windows7 x86, the software is working fine in my system but not in my client system, i am using c#, vs2010, msssql, i made debug as x86, please someone give solution...

August 17, 2016, Yogesh says:

Move excel variables which is global declare in your form to local like in my form i have: Dim xls As New MyExcel.Interop.Application,Dim xlb As MyExcel.Interop.Workbook
above two lines were declare global in my form so i moved these two lines to local funtion. and now tool is working fine.

November 6, 2016, Philip says:

That solved my problem. Thank you !

November 17, 2016, Bradley says:

Dude: You rock! Saved me a headache -- circa 2017

April 25, 2017, Shekhar says:

Thanks...

May 3, 2017, Roxanne O'Neill says:

Thank you so much. Your solution was the only one that worked!!

October 18, 2017, Yossi Weiss says:

Your solution works on october 2017!!!

December 11, 2017, Shreeja M S says:

Hi, My Operating System is Win7 64 bit, if i install M S Office, my code works fine, but if i uninstall Office and install the MS Office Redistributable(Interop Service) , my code fails giving the same error.
Can u help me out here as i need it to work without MS Office in my system


October 11, 2021, neha says:

I have VS 2019. Tried changing any cpu to x86 and x64 nothing works. I am using windows 10, my program was written in 32bit on windows xp. I still get Unhandled Exception: System.Runtime.InteropServices.COMException: Retrieving the COM class factory for component with CLSID. My build is success but when I try to debug I get the unhandled exception.

October 14, 2021, Amalina says:

Hi
I also facing quite same problem with some of you guys. anyone can help?

this is the error:
Error HRESULT E_FAIL has been returned from a call to a COM component.

I used VS2017. the third part library is 32bit (AcroPDFlib). I already compiled to x86. Only 1 pc show this error when try to open document. this PC is 64bit. at My site also no problem, other user also no problem.

November 19, 2021, Amalina says:

Hi, my friend already found solution for my problem above.

we open Acrobat Reader DC at the problematic user PC, go to:
Edit > Preference > Internet > Internet Setting > Programs > manage Add-ons > find name: Adobe Acrobat Reader (if cannot find, change show dropdown to Run Without Permission) > Change Status to enabled.

originally the setting at this user PC is set to disabled. we change to enabled and the problem solved.


Comment on This Article:

Your Name:
Your Email Address:
 

Your Email Address will not be made public,
but the MD5 hash of it will be used to display your Gravatar.
Comment:
All HTML, except <i>, <b>, <u> will require your comment to be moderated before it is publicly displayed.
 
If you would like your own avatar displayed, read about comment avatars.