By-passing the default PowerPoint save dialog

D

Dwarf Nebula

Hello,

I am working on add-ins for Word 2007, Excel 2007 and PowerPoint 2007, using
VSTO 3.0 within VS 2008. The add-in uses a custom save dialog instead of the
default save dialog. The functionality works fine in Word and Excel, but I'm
having an issue with PowerPoint.

The problem is that when I use the Presentation.SaveAs(...) call, it
displays the default dialog instead of just performing the save operation.
Here is the entirety of the sample code that generates the issue.

private void ThisAddIn_Startup(object sender, System.EventArgs e)
{
this.Application.PresentationBeforeSave += new
Microsoft.Office.Interop.PowerPoint.EApplication_PresentationBeforeSaveEventHandler(Application_PresentationBeforeSave);
}

void
Application_PresentationBeforeSave(Microsoft.Office.Interop.PowerPoint.Presentation Pres, ref bool Cancel)
{
Pres.SaveAs("c:\\PowerPointPres.pptx",
Microsoft.Office.Interop.PowerPoint.PpSaveAsFileType.ppSaveAsXMLPresentation,
Microsoft.Office.Core.MsoTriState.msoFalse);

Cancel = true;
}

When the Pres.SaveAs is called, the default SaveAs dialog pops up. What am
I doing wrong, or is this the default behavior?

Any help would be very much appreciated.

Thanks,
Gary
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top