Is it possible from the Powerpoint slide, I can access to a Ribbon menu item? For example, I have a checkbox under the Ribbon Menu. Now I want that when I click a shape, this checkbox should be checked?
The issue seems to be easy, but I cannot find a way to do it. Do you have any idea? (prefer in C#)
EDITED with CODE
The custom ribbon menu
public partial class RibbonMenu { private void RibbonMenu_Load(object sender, RibbonUIEventArgs e) { } public void ChangeCheckBox() { System.Windows.Forms.MessageBox.Show("The CheckBox is changed"); this.checkBox.Checked = true; this.checkBox.Label = "AAAAAAA" } }
Catch the selection event
public partial class ThisAddIn { private RibbonMenu menu; private void ThisAddIn_Startup(object sender, System.EventArgs e) { CreateRibbonExtensibilityObject(); Application.WindowSelectionChange += new PowerPoint.EApplication_WindowSelectionChangeEventHandler(Application_WindowSelectionChange); } protected override Microsoft.Office.Core.IRibbonExtensibility CreateRibbonExtensibilityObject() { this.menu = new RibbonMenu(); return Globals.Factory.GetRibbonFactory().CreateRibbonManager(new Microsoft.Office.Tools.Ribbon.IRibbonExtension[] { this.menu }); } private void Application_WindowSelectionChange(PowerPoint.Selection Sel) { //.... Check if the selection is a shape's selection this.menu.ChangeCheckBox(); } }
The Result is the message box "The CheckBox is changed"" is appeared, but the checkbox is not cheched and the label is not changed to "AAAAAA"