VSTO:无法打开另一个 Excel 文件,而第一个文件被加载项的模式窗口阻止

发布于 2024-08-06 18:03:34 字数 220 浏览 2 评论 0原文

我们无法打开另一个 Excel 文件,而第一个文件被我们的加载项中的模式窗口阻止。关闭对话框窗口将解冻所有打开的挂起文件。

Excel 版本是 2007。是否有编程解决方法,允许 Microsoft Excel 2007 在单独的窗口中打开第二个文件,而第一个窗口正在等待加载项退出模式对话框窗口?

注意:这种行为似乎也适用于 Excel 自己的对话框窗口。

We can't open another Excel file, while first file is blocked by modal window from our Add-in. Closing the dialog window unfreezes all pending file opens.

Excel version is 2007. Is there a programmatic work around, that would allow Microsoft Excel 2007 to open the second file in a separate window, while first window is waiting for the Add-in to get out of the modal dialog window?

NB: it seems that this behavior applies to Excel's own dialog windows as well.

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

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

发布评论

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

评论(3

不弃不离 2024-08-13 18:03:34

不,这是 Excel 自动化服务器编写方式的体系结构限制。只有一个线程为自动化队列提供服务 - 如果 Excel 位于调用堆栈的顶部并且有任何内容阻塞了较低的位置,则对自动化服务器的新调用将排队,直到它返回。

No- it's an architectural limitation of the way Excel's automation server is written. There's only one thread servicing the automation queue- if Excel is at the top of the call stack and anything is blocking lower down, new calls to the automation server are queued until it comes back.

ゞ记忆︶ㄣ 2024-08-13 18:03:34

我目前正在将我们的应用程序升级到 Excel 2007 和 VS 2010(针对 .NET 4.0),我确实注意到,如果您使用的是 CustomTaskPane,它似乎正在不同的线程上运行。我有一个插件,它创建一个任务窗格,启动一个模式表单,并从该表单中添加一个新的工作簿。它似乎工作没有问题。如果我直接从插件启动模态表单,我确实会遇到您所描述的相同问题。我不确定这是否适用于 .NET 3.5 或 2.0,但值得一试。 (有关 CustomTaskPane 的更多信息:http://msdn.microsoft。 com/en-us/library/aa942864(VS.100).aspx)

I'm currently upgrading our application to Excel 2007 and VS 2010 (targeting .NET 4.0) and I did notice that you if you are using a CustomTaskPane, it seems to be running on a different thread. I have an addin that creates a task pane which launches a modal form and from that form I add a new workbook. It seems to work without a problem. If I launch the modal form directly from the addin I do get the same problem you described. I'm not sure if this will work in .NET 3.5 or 2.0 but it's worth a shot. (More on CustomTaskPane: http://msdn.microsoft.com/en-us/library/aa942864(VS.100).aspx)

情释 2024-08-13 18:03:34

我能立即想到的唯一选择是从您的外接程序中创建一个新的 Excel.Application 实例,并使用该实例打开待处理的文件。不理想,但正如其他答案所说,这是产品的限制。 (Excel)

Only option I can think of off-hand is to create a new instance of Excel.Application from within your addin and use this instance to open the pending files. Not ideal but as other answer says it is a limitation of the product. (Excel)

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