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

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

问题描述

这里已经描述了在没有管理员权限的情况下调用 regasm 的解决方法:

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

没有 regasm 的 COM 互操作

我正在尝试创建一个 COM 库,我的用户可以在没有管理员权限的情况下从 Excel VBA 部署和使用该库.我喜欢 regasm 解决方法,因为人们似乎在使用 Excel VBA 中的免注册 COM 对象方面没有取得多大成功.我还希望提前绑定,以便我的用户可以从语法补全中受益.

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.

但是,上述问题中接受的答案并未描述将程序集 dll 放在用户计算机上的哪个位置.在 GAC 中安装程序集需要管理员权限,所以我想知道可以将 dll 文件放在哪里.我假设正在搜索应用程序的目录以查找任何引用的 dll,但如果没有管理员权限,我无法将我的 dll 放入 Excel 的目录中.是否可以使用 Excel 客户端的解决方法?有没有其他方法可以从 VBA 调用 COM 对象而无需管理员权限先部署它们?

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?

推荐答案

在没有 COM 互操作管理权限的情况下调用 regasm

Calling regasm without administrative rights for COM interop

我认为应该可以使用 RegistrationServices.RegisterAssemblyRegOverridePredefKey API 一起实现 HKCU hive 下的自动注册,在一个UAC 友好的方式.我已在此处发布了更详细的答案.

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天全站免登陆