asked on
Problem instantiating an .net object from VBA
An Access 2003 program has a reference to a .net dll. *On one computer only (the other computers don't have this problem)*, vba throws an error when it tries to create an instance of a class defined in the dll. Vba declares a variable of that type without an error; it's when it tries to create an instance of the class types that it throws an error. The error message is "Class does not support Automation or does not support expected interface." I wrote code so show the references, and the reference to the .dll has the correct path and is not broken. xyz.dll and xyz.tlb are both in the SysWOW64 folder, and when I run "regasm.exe xyz.dll /codebase" I get a successful message. I even tried to reinstall Access 2003 runtime and I tried unregistering and re-registering xyz.dll but still have the same problem. How can I fix this problem?
Then: Using COM+ automation requires correctly installed (regasm) components. Depending on the component, their installer and number of updates over a longer period, the registry entries can get wrong. Here uninstalling all versions of that component and doing a clean reinstall should do it. Also check whether your DLL and TLB are of the same version.
And finally as @Chinmay could by right: If your component is as old as the used RT, then the needed .NET framework is not installed per default on actual machines.
ASKER
ASKER
1) Unregister it
2) Delete all copies of it.
Also ensure you register the problematic DLL, generating the TLB in the same location as the other computers. Access must be closed while doing this.
ASKER