Excel Interop-取消选择 [英] Excel Interop - Cancel selection

查看:62
本文介绍了Excel Interop-取消选择的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要在Excel工作表中复制和插入行,就像这样:

I'm copying and inserting rows in an Excel sheet, like so:

   while (rowsToAdd > 0)
   {
      // copy the existing row
      insertionCell.EntireRow.Copy(Type.Missing);

      // location of the new row
      Range newRow = insertionCell.EntireRow.get_Offset(1, 0).EntireRow;

      // insert the new row
      newRow.Insert(XlInsertShiftDirection.xlShiftDown, Type.Missing);

      rowsToAdd--;
   }

我遇到的问题是,有时我会在最初复制的行周围留下选择框.

The problem I have is that sometimes, I'm left with a selection marquee around the row I originally copied.

有没有一种方法可以取消选择选框(通常使用Escape键进行选择?)

Is there a way I can cancel the selection marquee (the way you'd normally do it with the Escape key?)

推荐答案

在VBA中,它是Application.CutCopyMode = False

这篇关于Excel Interop-取消选择的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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