Excel作为Word中的OLE服务器运行时Application.InputBox问题 [英] Application.InputBox problems when Excel is running as OLE server within Word

查看:168
本文介绍了Excel作为Word中的OLE服务器运行时Application.InputBox问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们已经开发了一个VSTO插件,在表单上有多个Application.InputBox调用,用于选择工作表范围。 只需在Excel中运行,输入 框就可以正常运行,但是当在Word中运行时,作为嵌入的
对象,无法专注于工作表来选择单元格。

We have developed a VSTO addin that has a number of Application.InputBox calls, on a form, for selecting sheet ranges.  The input boxes work great when simply running within Excel, however when running within Word, as an embedded object, it is not possible to focus on the sheet to select cells.

从目前为止的测试中,如果直接从Ribbon代码调用,则InputBox代码可以正常工作,但从Windows窗体调用时会失败。

From our tests so far, the InputBox code works fine if called directly from Ribbon code but fails when called from a Windows form.

提前致谢,

Simon。

推荐答案

您好,

>如果直接从Ribbon代码调用,则InputBox代码可以正常工作,但从Windows窗体调用时会失败。

> the InputBox code works fine if called directly from Ribbon code but fails when called from a Windows form.

请注意,在这两种情况下,InputBox的父窗口是不同的。在调用Application.InputBox之前,您可以尝试将焦点设置为Excel窗口吗?也许,选择一个单元就足够了......

Note that the parent windows of the InputBox are different in these two cases. Can you try to set the focus to an Excel window before you call Application.InputBox? Maybe, selecting a cell would be enough...


这篇关于Excel作为Word中的OLE服务器运行时Application.InputBox问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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