Register com dll for use by vba

戏子无情 提交于 2019-12-11 01:57:29

问题


I have a very basic question. I have developed a com dll to be used from Access vba. Works great on my development machine. On a test machine I get the

"error -2147024894 (80070002) Automation Error
System can't find the specified file"

msg when I run the Access application.

When in design view the dll is referenced and all the objects and properties show up in the vba ide.

I am wondering if I am using the wrong regasm to register the dll? I develop on a 64 bit machine using VS 2010.

I compile the dll to run on x86 in Framework 3.5. Should I use the framework v2. o.50727 or Framework\v4.0.30319 to register the dll. Not clear to me what the difference is. Is the version used determined by the development version of VS or the .NET version you compile in? Is one used for 32 bit and the other for 64 bit?

I have been fighting this for 2 days and have made some headway but can't get the Access routines to actually set an instance of the dll in runtime.

Thanks in advance for any assistance.


回答1:


If you are compiling under v3.5, you should use that regasm. However, I think you might need to add the /tlb and /codebase switches to generate the type library that you can use in vba apps. You can then ref the .tlb file and you should be golden.




回答2:


You need to register your COM dll using regsvr32 for referencing it from VBA.




回答3:


VBA uses COM DLLs. You would have to use C++, not the .Net framework.



来源:https://stackoverflow.com/questions/10157735/register-com-dll-for-use-by-vba

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!