object m = Type.Missing; const int MENU_ITEM_TYPE = 1; const int NEW_MENU = 18; CommandBarControl oNewMenu = ExcelGlobals.Application.CommandBars["Wor ...
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;
}
}