【发布时间】:2012-08-10 20:53:35
【问题描述】:
我想从功能区控件中获取活动范围。只有当功能区上的控件需要它时,才应该有一种方法可以访问选定的单元格。
目前我就是这样做的;
public partial class ThisAddin
{
private void SheetSelectionChange(object sh, Range target)
{
int count = target.Count;
if (count < 5000) // This is for performance reasons
{
//Set a custom range property in the office ribbon
Req_Tool.ActiveRange = target;
{
}
}
我觉得这是虚弱和浪费。
首先,每次选择更改我的代码都会运行。
其次,我有两份选择的副本,无论是否使用。
必须有更好的方法来做到这一点,我忽略了。
【问题讨论】:
标签: c# vsto excel-2010