我的自定义 Outlook 加载项导致 Excel 保存对话框隐藏自身

发布于 2024-12-25 22:15:00 字数 574 浏览 2 评论 0原文

我创建了一个 Outlook 加载项,将一个按钮添加到新电子邮件窗口的功能区,但它导致了问题。

发生的情况如下:

  1. 用户打开了 Outlook。
  2. 用户打开 Excel。
  3. 用户通过“文件”->“保存并发送”->“作为附件发送”将 excel 文档发送给某人 用户
  4. 对文档进行了更改
  5. 用户尝试关闭文档
  6. 此时 Outlook 会提示用户保存文件,但弹出对话框隐藏在 Excel 窗口后面,用户如果不做一些恶作剧就无法访问它。

我的 Outlook 加载项还执行许多其他操作,但我已将其固定到我创建的 Ribbon.cs 文件中,以向新电子邮件窗口添加按钮。当我将 OfficeRibbon 对象的 RibbonType 属性从 Micorosft.Outlook.Mail.Compose 更改为空时,“保存”对话框将按其应有的方式显示。当我将其更改回“撰写”时,它再次隐藏对话框。

有谁知道有什么办法解决这个问题吗?我已确认当项目是 Outlook 2007 加载项或 Outlook 2010 加载项时会发生这种情况。

提前致谢。

I have created an Outlook Add-In that adds a button to the ribbon of a new email window, but it's causing a problem.

Here is what happens:

  1. User has Outlook Open.
  2. User opens Excel.
  3. User sends excel document to someone via File->Save and Send->Send as Attachment
  4. User makes a change to the document
  5. User attempts to close the document
  6. This is when Outlook prompts the user to save the file, but the dialog box is hidden behind the Excel window and the user can't get to it without doing some shenanigans.

My Outlook Add-in does many other things, but I've pinned it down to the Ribbon.cs file I created to add a button to the new email window. When I change the RibbonType property of the OfficeRibbon object from Micorosft.Outlook.Mail.Compose to nothing, the Save Dialog shows as it should. When I change it back to "Compose", it hides the dialog box again.

Does anyone know of any way around this? I have confirmed this happens when the project is either an Outlook 2007 Add-In or an Outlook 2010 Add-In.

Thanks in advance.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

半城柳色半声笛 2025-01-01 22:15:00

因此,参考 user1217053 发送的链接,答案可能是...

为 Outlook.Mailitem 创建一个类范围字段
将其绑定到 BeforeClose 事件。

在该字段的 BeforeClose 事件处理程序中,添加诸如 ... 之类的代码,

cMailItem_BeforeClose(bool Cancel)
{
  var Insp = cMailItem.GetInspector();
  Insp.Close();
  Marshal.FinalReleaseCOMObject(Insp);
  Insp = null;
}

然后希望这将摆脱影子检查器。

So in reference to the link sent by user1217053 the answer would probably be along the lines of...

create a class scope field for the Outlook.Mailitem
have it bind to the BeforeClose event.

Inside the BeforeClose event handler for this field, add code such as ...

cMailItem_BeforeClose(bool Cancel)
{
  var Insp = cMailItem.GetInspector();
  Insp.Close();
  Marshal.FinalReleaseCOMObject(Insp);
  Insp = null;
}

Then hopefully this will get rid of the shadow inspector.

寂寞陪衬 2025-01-01 22:15:00

我不知道您是否仍在解决这个问题,但我遇到了完全相同的问题,然后找到了解决方案。您一定和我一样使用功能区设计器。功能区设计者导致了这个问题。我不得不从功能区设计器更改为功能区 XML。删除代码和更改一些逻辑需要做一些工作,但这解决了问题。我听说另一种选择是使用包装类。

希望这有帮助。

I dont know if you are still working on with this problem or not, but I faced the exact same problem and then found the solution. You must be using the Ribbon designer just like I was. The ribbon designer cause this problem. I had to change from Ribbon designer to Ribbon XML. It was a little bit of work to remove code and change some logic, but that fixed the problem. I heard the other altenative is to use a wrapper class.

Hope this helps.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文