PowerPoint animations won't play from C# application

T

tgaihdc

I'm trying to drive a slideshow in PowerPoint 2002 with a C#
application built in Visual Studio 2003. I'm using the
SlideShowView.Next() method. The first call to Next() causes the
object with a onclick animation to disappear. The next call to Next()
causes the object to reappear. Using the same code in a VBA macro runs
the slideshow perfectly. Does any one know what's going wrong? I've
attached the relevant sample code:

PowerPoint.SlideShowSettings s =
m_oPPT.ActivePresentation.SlideShowSettings;
s.ShowType = PowerPoint.PpSlideShowType.ppShowTypeSpeaker;
s.LoopUntilStopped = Microsoft.Office.Core.MsoTriState.msoFalse;
s.ShowWithNarration = Microsoft.Office.Core.MsoTriState.msoTrue;
s.ShowWithAnimation = Microsoft.Office.Core.MsoTriState.msoTrue;
s.RangeType = PowerPoint.PpSlideShowRangeType.ppShowAll;
s.AdvanceMode =
PowerPoint.PpSlideShowAdvanceMode.ppSlideShowUseSlideTimings;
s.PointerColor.SchemeColor =
PowerPoint.PpColorSchemeIndex.ppForeground;
s.Run();

In a button handler, I've reduced the code to:

PowerPoint.SlideShowWindows win = m_oPPT.SlideShowWindows;
win.Item(1).View.Next();
Any assistance would be greatly appreciated. Thanks.

Tim
 
T

tgaihdc

I made some progress in diagnosing the problem. Apparently, the
animations will play properly if I make my Next() calls in the same
button handler that starts the slideshow. However, this isn't
acceptable for my application since the slides/animations must advance
under user control. Any one have any ideas? Thanks.

Tim
 
T

tgaihdc

I solved my problem. I had to call SlideShowWindow.Activate() before
calling Next() to play the animations correctly.

Tim
 
S

Steve Rindsberg

I solved my problem. I had to call SlideShowWindow.Activate() before
calling Next() to play the animations correctly.

Thanks for posting that. I'm doing something similar, but from VB. Haven't
run into this one, but it's good to have in reserve.

Another little trick; if you want the user to control each animation regardless
of whether it's got timings attached or not, you can add a .Pause call
immediately after each .Next
 

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