如何判断Excel的应用是在细胞编辑模式? [英] How to tell if Excel Application is in cell-edit mode?

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

问题描述

我使用COM互操作从.NET编写一个Excel加载项。我有一个弹出一个对话框的命令,然后从对话框我喜欢从多张的使用范围收集数据的一些工作。现在的问题是,如果一个单元是在编辑模式下,一些我需要做会抛出异常的话费。我想前手的Excel在编辑模式决定的方式,让我可以提醒用户完成第一个编辑单元格。

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.

任何想法?

推荐答案

有一个Application.Ready属性,应该给你这个信息,但在实践中并不可靠地工作。请参见这里的hackaround。

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.

您可能也想看看设置Application.Interactive =假,而你的.NET code正在尽自己的东西。

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

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

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