You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I was lucky to find this project. With its help, I can set a shortcut to my PPT VSTO addin.
The core part code is as below.
When I pressed the defined shortcut, both my addin's function and PPT's internal command will be executed.
This has one side effect that the window triggered by my addin won't be focused.
I've tried to add frm.activate() or frm.focus, but none of them works.
What can I do to excute only my addin's function? Any comments will be apprciated.
using System;
using System.Collections.Generic;
using System.Windows.Forms;
using PowerPoint = Microsoft.Office.Interop.PowerPoint;
using Gma.System.MouseKeyHook;
namespace PowerPointAddIn1
{
public partial class ThisAddIn
{
public static PowerPoint.Application PPTApp;
private void ThisAddIn_Startup(object sender, System.EventArgs e)
{
var QRun = Combination.FromString("Alt+E");
Action actionQRun = ShowQRunWin;
var assignment = new Dictionary<Combination, Action>
{
{QRun, actionQRun}
};
Hook.AppEvents().OnCombination(assignment);
}
public void ShowQRunWin()
{
CMDForm frm = new CMDForm();
frm.FormBorderStyle = FormBorderStyle.FixedSingle; //set it un-resizeable
frm.MaximizeBox = false; //remove maximize button
frm.MinimizeBox = false; //remove minimize button
frm.Show();
frm.Activate();
frm.Focus();
}
private void ThisAddIn_Shutdown(object sender, System.EventArgs e)
{
}
#region VSTO generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InternalStartup()
{
this.Startup += new System.EventHandler(ThisAddIn_Startup);
this.Shutdown += new System.EventHandler(ThisAddIn_Shutdown);
}
#endregion
protected override Microsoft.Office.Core.IRibbonExtensibility CreateRibbonExtensibilityObject()
{
return new RibbonUI();
}
}
}
The text was updated successfully, but these errors were encountered:
valuex
changed the title
How to surpress the overide PPT's internal shortcut combination?
How to override PPT's internal shortcut combination?
May 15, 2021
@valuex
I am using this package also and want to define a mouse click event to powerpoint chart object. But the error is showing about Chart Object has no mouseevents. How can you solve this problem? Please help. Thanks
I was lucky to find this project. With its help, I can set a shortcut to my PPT VSTO addin.
The core part code is as below.
When I pressed the defined shortcut, both my addin's function and PPT's internal command will be executed.
This has one side effect that the window triggered by my addin won't be focused.
I've tried to add
frm.activate()
orfrm.focus
, but none of them works.What can I do to excute only my addin's function? Any comments will be apprciated.
The text was updated successfully, but these errors were encountered: