简体   繁体   中英

How to Differentiate SaveAs call and Save call in PowerPoint events?

I'm writting AddIn for PowerPoint 2010. I'm using two functions of PowerPoint.

Application_PresentationBeforeSave(ByVal Pres As Microsoft.Office.Interop.PowerPoint.Presentation, ByRef Cancel As Boolean)

Application_PresentationSave(ByVal Pres As Microsoft.Office.Interop.PowerPoint.Presentation)

When I perform Save operation (Ctrl+S) or SaveAs (File -> SaveAs) on powerpoint it executes Application_PresentationBeforeSave() method.

But I need to differentiate these two calls (Ctril+S & SaveAs) and accordingly perform some task. So how can I differentiate these two calls in BeforeSave method ??

As for Word, in Application_DocumentBeforeSave(ByVal Doc As Microsoft.Office.Interop.Word.Document, ByRef SaveAsUI As Boolean, ByRef Cancel As Boolean) there is SaveAsUI flag which differentiate whether this method has been called by SaveAs or Ctrl+S action.

So is there any flag/property which differtiate same things in PowerPoint ??

You need to repurpose the ribbon buttons or replace the backstage UI controls with your own so you will know what action users chose in the UI. In case of ribbon controls see the Temporarily Repurpose Commands on the Office Fluent Ribbon article in MSDN. The Backstage UI is described in the following articles in MSDN in depth:

Introduction to the Office 2010 Backstage View for Developers

Customizing the Office 2010 Backstage View for Developers

In case of Ctrl+S shortcuts you need set a keyboard hook using Windows API functions, see Using shortcut keys to call a function in an Office Add-in for more information.

Thanks Eugene for showing me a way. My problem got resolve. I tried your suggestion.

Here is the description of my solution. I have added function call in Ribbon.xml

In MySaveAs() function I set one glbal variable. And used it in BeforeSave mthod.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM