Using Visual Studio 2008 I’ve built a COM object that targets the .Net Framework 2.0.
I’m trying to use the component in MS Access 2007 on XP SP3. If I use early binding it works flawlessly. If I use late binding I get this error:
Run-time error '429':
ActiveX component can't create object
Here’s my code:
Dim objTest as Object
Set objTest = CreateObject("MyComNameSpace.MyComClass") 'Error occurs here
Well, looks like the ProgId isn’t “MyComNameSpace.MyComClass”. Look in the registry with Regedit.exe, it should be present in HKEY_CLASSES_ROOT. The key contains a CLSID key with a guid for your class. That key should be present in
HKLM\Software\Classes\CLSID\{guid}. Which contains keys written by Regasm.exe to get the CLR started and your assembly loaded.You can see these keys being searched by the COM client program with SysInternals’ ProcMon utility, a decent way to diagnose what’s missing.
You can use the [ProgId] attribute to pick your own instead of letting the it up to .NET to pick one.
Just in case, just because you use late-binding does not mean that you can skip the registration step. Be sure to run Regasm.exe with the /codebase option from an elevated command prompt to get the keys registered.