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;
}
}