2
我正在開發使用VSTO的MS Word 2010插件。這個詞有一個「自定義鍵盤」對話框:獲取Word中菜單項的宏命令名稱
「命令」列表中包含內置的宏命令每個分配給某些菜單或動作。可以使用Application.Run()
方法從VSTO執行它們。
我需要獲得表「菜單項名稱」的記錄 - 「宏命令名稱」 - 「鍵盤快捷鍵」的Word當前安裝的實例。
我試過到目前爲止:
Application.CustomizationContext = Application.NormalTemplate;
foreach (CommandBar bar in Application.CommandBars)
{
// Name of menu group
Application.Selection.InsertAfter(bar.NameLocal + "\n");
foreach (CommandBarControl control in bar.Controls)
{
// Human-readable name
Application.Selection.InsertAfter("\nName:" + control.accName
// Broad description
+ "\nDescription:" + control.DescriptionText
// Keyboard shortcut
+ "\nShortcut:" + control.accKeyboardShortcut);
}
}
可惜CommandBarControl
不包含宏命令名稱字段。我想知道如何收集和粘合在一起?