[Powerpoint]: Save as dialog box RRS feed

  • Question

  • Hello!

    I need to know the presentation name and presentation path when it changes. So I have created an event handler for PresentationBeforeSave event.

    This handler sets the cancel parameter to true and shows a save as dialog box:


                    cancel = true;
                    Microsoft.Office.Core.FileDialog fd = this.Application.get_FileDialog(Microsoft.Office.Core.MsoFileDialogType.msoFileDialogSaveAs);
                    this.Application.ActivePresentation.SaveAs(fd.SelectedItems.Item(1), Microsoft.Office.Interop.PowerPoint.PpSaveAsFileType.ppSaveAsPresentation, Microsoft.Office.Core.MsoTriState.msoTrue);}

    catch(Exception e){}


    unfortunately I am getting a Presentation (unknown member) : failed exception message.

    Does anyone know hot can I obtain the name and the path of my presentation after a save as?



    Thank u


    Wednesday, November 10, 2010 4:00 AM


  • Hi JulianaBooleana,

    If you just want to know the save path and name of the PowerPoint after save, you can use the code below:

     PowerPoint.Application powerApp;
        private void ThisAddIn_Startup(object sender, System.EventArgs e)
          powerApp = this.Application;
          powerApp.PresentationSave += new PowerPoint.EApplication_PresentationSaveEventHandler(powerApp_PresentationSave);
        void powerApp_PresentationSave(PowerPoint.Presentation Pres)
          string pname=powerApp.ActivePresentation.Name;
          string path = powerApp.ActivePresentation.Path;
          MessageBox.Show(pname+" "+path);
    Hope it helps.

    Best Regards,
    Amy Li
    Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.
    • Marked as answer by Amy Li Wednesday, November 17, 2010 1:34 AM
    Thursday, November 11, 2010 2:54 AM