在Excel VBA中调用没有COM互操作的管理权限的regasm [英] Calling regasm without administrative rights for COM interop in Excel VBA

查看:306
本文介绍了在Excel VBA中调用没有COM互操作的管理权限的regasm的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

COM Interop without regasm



我正在尝试创建一个COM库,我的用户可以从Excel VBA部署和使用没有管理员权限。我喜欢regasm的解决方法,因为似乎人们使用Excel VBA中无注册的COM对象没有太大的成功。我也希望早期绑定,所以我的用户可以从语法完成中获益。



然而,上面提到的问题中接受的答案并没有描述将程序集dll在用户的电脑上。管理员权限需要在GAC中安装程序集,所以我想知道哪里可以放置dll文件。我推测应用程序的目录正在搜索任何引用的DLL,但是我不能将我的DLL放在Excel的目录中,而不再需要管理员权限。可以使用Excel客户端的解决方法吗?有没有其他方法可以从VBA调用COM对象,而不需要管理员权限首先部署?

解决方案


调用没有COM Interop的管理权限的regasm


我认为应该可以使用 RegistrationServices。 RegisterAssembly RegOverridePredefKey 在一起实施自动注册的 HKCU hive,一个UAC友好的方式。我已经发布了更详细的答案此处


A workaround for calling regasm without the admin rights was described here already:

COM Interop without regasm

I'm trying to create a COM library that my users can deploy and use from Excel VBA without the admin privileges. I liked the regasm workaround, since it seems that people don't have much success with using registration-free COM objects from Excel VBA. I also want early binding so my users can benefit from syntax completion.

The accepted answer in the question mentioned above, however, doesn't describe where to put the assembly dll on the user's computer. Admin rights are required to install the assembly in the GAC, so I'm wondering where one can put the dll file. I presume that the application's dir is being searched for any referenced dlls, but I can't put my dll in the Excel's dir without the admin rights again. Is it possible to use the workaround with the Excel client? Is there any other way to call COM objects from VBA without the need of the admin privileges to deploy them first?

解决方案

Calling regasm without administrative rights for COM interop

I think it should be possible to use RegistrationServices.RegisterAssembly and RegOverridePredefKey APIs together to implement automatic registration under the HKCU hive, in a UAC-friendly way. I've posted a more detailed answer here.

这篇关于在Excel VBA中调用没有COM互操作的管理权限的regasm的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆