如何判断Excel应用程序是否处于单元格编辑模式? [英] How to tell if Excel Application is in cell-edit mode?

查看:170
本文介绍了如何判断Excel应用程序是否处于单元格编辑模式?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用.net中的COM Interop编写一个Excel Addin。我有一个弹出对话框的命令,从对话框中我做了一些工作,例如从几个工作表的使用范围收集数据。问题是,如果一个单元格处于编辑模式,我需要做的一些调用会抛出异常。我想要一种确定Excel处于编辑模式的方法,以便我可以先提醒用户完成编辑单元。



任何想法? / p>

解决方案

有一个Application.Ready属性应该给你这个信息,但实际上它不能可靠地工作。请参阅此处以获取解决方案。



您可能还需要查看设置Application.Interactive = false,而.net代码正在执行其中的任何操作。


I'm writing an Excel Addin using COM Interop from .net. I have a command that pops up a dialog, and from the dialog I do some work like collecting data from the used range of several sheets. The problem is that if a cell is in edit mode, some of the calls that I need to make will throw exceptions. I would like a way of determining before-hand that Excel is in edit mode, so that I can warn the user to finish editing the cell first.

Any ideas?

解决方案

There is an Application.Ready property that is supposed to give you this information but in practice it doesn't work reliably. See here for a hackaround.

You might also want to look at setting Application.Interactive=false while your .net code is doing its stuff.

这篇关于如何判断Excel应用程序是否处于单元格编辑模式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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