John Wesley Gordon
John Wesley Gordon

Reputation: 910

Advancing Powerpoint Slide Show Animations Automatically Following Timing

I have a power point slide show that I am accessing in C#. It opens and comes up on the screen and I can manually step through it, but it already has timings on it in the animations tab. How can I just start the show and run according to the settings in Animations in the powerpoint?

Microsoft.Office.Interop.PowerPoint.Application app = null;
Microsoft.Office.Interop.PowerPoint.Presentation pres = null;
app = new Microsoft.Office.Interop.PowerPoint.Application();
app.SlideShowNextSlide += new Microsoft.Office.Interop.PowerPoint.EApplication_SlideShowNextSlideEventHandler(app_SlideShowNextSlide);
pres = app.Presentations.Open(filename,
                Microsoft.Office.Core.MsoTriState.msoTrue, Microsoft.Office.Core.MsoTriState.msoTrue, Microsoft.Office.Core.MsoTriState.msoFalse);
//I was hoping this line would just run my show with the timings but it does not.
pres.SlideShowSettings.Run();
pres.SlideShowWindow.View.First();

And to manually advance I have been doing

pres.SlideShowWindow.View.Next();

Upvotes: 0

Views: 1018

Answers (1)

John Wesley Gordon
John Wesley Gordon

Reputation: 910

It turns out I only needed one more line to activate the animation timing.

pres.SlideShowSettings.ShowWithAnimation = Microsoft.Office.Core.MsoTriState.msoTrue; 

The full code

Microsoft.Office.Interop.PowerPoint.Application app = null;
Microsoft.Office.Interop.PowerPoint.Presentation pres = null;
app = new Microsoft.Office.Interop.PowerPoint.Application();
app.SlideShowNextSlide += new Microsoft.Office.Interop.PowerPoint.EApplication_SlideShowNextSlideEventHandler(app_SlideShowNextSlide);
pres = app.Presentations.Open(filename,
            Microsoft.Office.Core.MsoTriState.msoTrue, Microsoft.Office.Core.MsoTriState.msoTrue, Microsoft.Office.Core.MsoTriState.msoFalse);
pres.SlideShowSettings.ShowWithAnimation = Microsoft.Office.Core.MsoTriState.msoTrue;
pres.SlideShowSettings.Run();
pres.SlideShowWindow.View.First();

Upvotes: 1

Related Questions