简体   繁体   English

如何从excel中捕获outlook中的自定义按钮单击事件?

[英]How to capture custom button click event in outlook from excel?

I'm trying to control Outlook via Excel by VBA ofc. 我试图通过VBA ofc通过Excel控制Outlook。

My Excel code creates and XML that adds button to Message Ribbon. 我的Excel代码创建了XML,并为消息功能区添加了按钮。 The button's job is to save email to specific location given by Excel. 该按钮的作用是将电子邮件保存到Excel提供的特定位置。 I cant run Excel macro from Outlook macro because you cant access VB Project of Outlook. 我无法从Outlook宏运行Excel宏,因为您无法访问Outlook的VB项目。 It needs to be provided for couple of persons and this is hard to deploy and control. 它需要为几个人提供,这很难部署和控制。 So I thought maybe I can capture click event of that button from excel. 所以我想也许我可以从excel中捕获该按钮的click事件。 I've seen examples to capture Reply button but nothing else. 我已经看到了捕获“回复”按钮的示例,但没有其他内容。

I'm looking for place in Outlook object where this information might be stored. 我正在寻找可能存储此信息的Outlook对象中的位置。 And any help with that, different approaches are welcome as well. 对此有任何帮助,也欢迎不同的方法。

It looks like you need to develop a COM add-in instead of VBA macro. 看起来你需要开发一个COM加载项而不是VBA宏。 First of all, you can't modify the Ribbon UI in Outlook from VBA macros as you do it in Excel. 首先,您无法像在Excel中那样在VBA宏中修改Outlook中的功能区UI。 Second, VBA macros are not designed for distributing them on multiple machines. 其次,VBA宏不是为在多台机器上分发它们而设计的。 That is what COM add-ins were invented for. 这就是COM加载项的发明。 See Walkthrough: Create your first VSTO Add-in for Outlook to get started quickly. 请参阅演练:为Outlook创建第一个VSTO加载项以快速入门。

The following articles provide instructions on how to create a custom ribbon UI: 以下文章提供了有关如何创建自定义功能区UI的说明:

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM