vsto 检测是否在编辑状态或者光标闪动

object m = Type.Missing;
const int MENU_ITEM_TYPE = 1;
const int NEW_MENU = 18;

CommandBarControl oNewMenu =
ExcelGlobals.Application.CommandBars["Worksheet Menu Bar"].FindControl(
MENU_ITEM_TYPE, //the type of item to look for
NEW_MENU, //the item to look for
m, //the tag property (in this case missing)
m, //the visible property (in this case missing)
true); //we want to look for it recursively
//so the last argument should be true.

if (oNewMenu != null)
{
if (!oNewMenu.Enabled)
{
MessageBox.Show("当前文档有光标在闪动,请取消光标闪动");
return;
}
}

posted on 2019-11-25 09:37  GIS-MAN  阅读(297)  评论(0编辑  收藏  举报

导航