Excel-DNA/Samples

Solution not working

Opened this issue · 2 comments

Dear Govert
I am getting the run-time error '429': ActiveX component can't create object' with C# my solution which uses DNA to speak to Excel. I get this message in VBA when it tries to instantiate the .NET class. It all used to work fine till a few days ago. When looking for possible causes, I came across this solution of yours, which I tried. I still get the same error message. I guess it just shows that something has gone wrong on my machine, independent of the solution.

Would appreciate any help.

Thanks

Raj

@bsnataraj - That's very little information to go on. I'm not even sure which of the samples you are trying out, though I guess it's the COM server one? https://github.com/Excel-DNA/Samples/tree/master/DnaComServer The error message you show is very general, so that doesn't help much.

I suggest you either try on a different machine, and see whether that works, or start a tiny project that just contains the problem code, that you can then post somewhere so we can have a look, or explain some steps you are following to run into the problem..

Hi, my apologies, I should have provided more information.

My environment is as follows: OS - Windows 10, Office - 2010, Visual Studio - 2015

I have a C# application that interacts with Excel/VBA using Excel DNA (using early binding). It was working fine, but when I changed the C# code and recreated the .tlb file (using tlbexp), I noticed that I cound't add the new tlb file into VBA as a reference (the exported assembly wasn't getting selected and displayed in the added references table).

Then I looked at the registry and found that there was an entry for the same .tlb file from another folder (which I might have created during testing). So I manually edited the registry to remove the entry for the .tlb file from the test folder. I also removed references to any classes relating to that .tlb file.

Now I am able to add the new .tlb file as a VBA reference, but whenever I try to instantiate the exported C# object from within VBA, I get the error 429. In the VBA object browser, I can clearly see the exported C# classes and methods, but VBA can't instantiate them and throws the error 429.

This is when I tried the DnaComServer example you mention above, to make sure nothing is wrong with my Visual Studio solution. But I can't get even that working and get the same error 429. So I am thinking that something might have gone wrong when editing the registry (I have taken a backup, so can restore it if necessary).

Note - I add the .XLL file into Excel as a reference before adding the .tlb file as a reference in VBA. But I guess this shouldn't cause any issues as I have always done it this way whenever I have to recreate the .tlb file.

Please let me know if I can provide anymore information.

Thanks in advance for your time.

Raj