如何通过注册表启用 Excel 自动化加载项? [英] How do I enable an Excel Automation Add-in through the registry?

查看:358
本文介绍了如何通过注册表启用 Excel 自动化加载项?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个 Excel 自动化加载项,它由我的安装程序注册到 COM.通过向 COM 注册,我的加载项出现在(对于 Excel 2007)Excel 选项 > 加载项 > 管理 Excel 加载项转到... > 自动化列表中.用户仍必须导航到上面的对话框并选择我的加载项以启用它.

在使用 COM 注册类型后,是否可以(可能通过注册表项)在我的安装程序类(或在 VBA)中以编程方式启用我的自动机加载项?

提前致谢 - 弗兰克

解决方案

我没有专门做这些,但是我使用的参考资料对您的问题有这样的说法:

<块引用>

自动化加载项的加载方式与普通 .xla 加载项相同,但使用 ProgID 而不是文件名,如下代码所示:

Sub installAutomationAddIn()AddIns.Add 文件名:="Excel2007ProgRef.Simple"AddIns("Excel2007ProgRef.Simple").Installed = True结束子

<块引用>

如果您正在为加载项创建安装例程,您可能希望直接写入注册表以将自动化加载项设置为已安装.为此,您需要创建以下注册表项(如果您使用了上述代码,则该注册表项已经存在).

(在注册表项中:)HKEY_CURRENT_USER\SOftware\Microsoft\Office\12.0\Excel\Options(创建字符串值:)名称 = 系列中第一个未使用的项目:Open、Open1、Open2 等.值 =/A "Excel2007ProgRef.Simple"

I have an Excel Automation Add-in that is registered with COM by my installer. By registering with COM, my add-in appears in the (for Excel 2007) Excel Options > Add-Ins > Manage Excel Add-Ins Go... > Automation list. The users must still navigate to the dialog above and select my add-in to enable it.

Is it possible (via a registry key perhaps) to enable my automaton add-in programmatically in my installer class (or in VBA) after the types are registered with COM?

Thanks in advance - Frank

解决方案

Ive not done ths specifically, but a reference that I use has this to say regarding your question:

Automation Add-Ins are loaded in the same way as normal .xla Add-Ins , but using the ProgID instead of the file name, as in the following code:

Sub installAutomationAddIn()
    AddIns.Add Filename:="Excel2007ProgRef.Simple"
    AddIns("Excel2007ProgRef.Simple").Installed = True
End Sub

If you are creating an installation routinefor your Add-In, you may want to write directly to the registry in order to set the Automation Add-In as installed. To do so, you need to create the following registry entry (Which will already exist if you've used the above code).

(In the Registry Key:)
HKEY_CURRENT_USER\SOftware\Microsoft\Office\12.0\Excel\Options

(Create the string value:)
Name = the first unused item in the series: Open, Open1, Open2, etc.
Value = /A "Excel2007ProgRef.Simple"

这篇关于如何通过注册表启用 Excel 自动化加载项?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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