(Solved) – Regasm is not working / ActiveX component can’t create object

(solved)-–-regasm-is-not-working-/-activex-component-can’t-create-object

I wrote a C# .dll in Visual Studio which I want to call from excel VBA. (I used this tutorial)

On my Development PC where I set the settings in the Project properties for “Make COM-Visible”, “Register for COM interop” and “sign the assembly” it all works fine. The dll is getting registered authomaticaly by Visual Studio and I can select and set it in Excel in VBA Window > Tools > References

The use case now is that I can use that dll file on another PC which does not have Visual Studio installed.
As told in the tutorial and all around the internet the way to go is by using the commandline tool RegAsm.exe, what I did (If its usefull; I used the one in the following folder: C:WindowsMicrosoft.NETFramework64v4.0.30319RegAsm.exe)
The command to register the dll is: C:WindowsMicrosoft.NETFramework64v4.0.30319RegAsm.exe D:DebugDotNetLibrary.dll /tlb /codebase.
This runs without an error and the command line tells me that the typs have been registerd correctly and the tlb has been exported and registerd.

It seems like everything worked well and there is also an entry in the registry (ComputerHKEY_CLASSES_ROOTTypeLib) which referce to my dll but the library doesn’t show up in the Reference window in VBA like it did on the other PC.
If I select the tlb, which has been generated by the RegAsm manually, by clicking browse in the Reference Window, it gets added to the list. But if I then start the code I get the Error that the ActiveX component can’t create an object.

I’m inspecting this issue since several days now, so it would be very nice if some one could assist me with it.

Leave a Reply

Your email address will not be published. Required fields are marked *