首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 其他教程 > 其他相关 >

获取Excel中Undo旋钮的项目

2012-11-12 
获取Excel中Undo按钮的项目在VSTO中我们可以通过以下代码来获取Undo按钮的列表:private static Office.Com

获取Excel中Undo按钮的项目

在VSTO中我们可以通过以下代码来获取Undo按钮的列表:

        private static Office.CommandBars getCommandBars()        {            return (Office.CommandBars)Globals.ThisWorkbook.Application.GetType().InvokeMember("CommandBars"                , System.Reflection.BindingFlags.GetProperty,                null,                Globals.ThisWorkbook.Application,                null,                System.Globalization.CultureInfo.InvariantCulture);        }        private static string getLastUndo()        {            string result = string.Empty;            Office.CommandBars oCommandBars = getCommandBars();            Office.CommandBar oCommandBar = oCommandBars["Standard"];            Office.CommandBarControl oCommandBarControl = (Office.CommandBarControl)oCommandBar.Controls[14];            MessageBox.Show(oCommandBarControl.Caption);            MessageBox.Show(oCommandBarControl.accChildCount.ToString());            try            {                if (oCommandBarControl is Office.CommandBarComboBox)                {                    Office.CommandBarComboBox ocbcb = (Office.CommandBarComboBox)oCommandBarControl;                    for (int i = 1; i < oCommandBarControl.accChildCount; i++)                    {                        MessageBox.Show(ocbcb.get_List(i));                    }                }                else                {                    MessageBox.Show("No");                }            }catch(Exception ex){                MessageBox.Show(ex.Message);            }            return result;        }




欢迎访问《许阳的红泥屋》


欢迎访问《许阳的红泥屋》

热点排行