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   GIS-MAN  阅读(303)  评论(0编辑  收藏  举报

导航

< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5
点击右上角即可分享
微信分享提示