problems running animation with SlideShowView.Next()

T

Tim

I'm having a problem running a simple blink animation from C#. From my
C# program, when I use SlideShowView.Next(), the objects set to blink
disappear. It takes another SlideShowView.Next() to make the objects
reappear. So, not only does the blink malfunction, but it takes two
SlideShowView.Next() calls to advance past the animation rather than
one.

If I use the same code in a VBA macro, the animation runs fine.

I start the slide show with the following:

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

Tim

Here's some additional info. I'm using PowerPoint 2002 and Visual
Studio 2003. I tried some other animations and have the same problem.
The first call to Next() makes the object disappear. The next call to
Next() makes the object reappear. The chosen animation never plays.

Tim
 
D

David M. Marcovitz

Next usually goes to the next animation and the next slide if there are
not other animations. You might want to use GotoSlide instead (add 1 to
the current slide's SlideIndex to get to the next slide). I hope this
makes sense (and works) because I don't use Visual Studio or C#; I just
use VBA.
--David

--
David M. Marcovitz
Director of Graduate Programs in Educational Technology
Loyola College in Maryland
Author of _Powerful PowerPoint for Educators_
http://www.loyola.edu/education/PowerfulPowerPoint/
 
T

Tim

Thanks for the response, David. My problem is not slide advancement,
but playing the animation. I made some progress in diagnosing the
problem. It looks like the animations will play fine if I call Next()
within the same button event handler in which I start the slideshow.
However, when I move the Next() call to a different button, the
animations stop playing. Instead, the object with an animation
disappears. I attached VB code to demo the problem.

Tim

Insert at top of form:

Private m_oPPT As PowerPoint.ApplicationClass

Insert in New():

m_oPPT = New PowerPoint.ApplicationClass


Add two buttons and place this code in the event handler.

Private Sub Button1_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles Button1.Click

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

'
'this works, but I need to allow the user to advance to next
slide/animation
'at own pace
'
'Dim win As PowerPoint.SlideShowWindows
'With m_oPPT.SlideShowWindows.Item(1).View
' System.Threading.Thread.Sleep(100)
' .Next()
' System.Threading.Thread.Sleep(100)
' .Next()
' System.Threading.Thread.Sleep(100)
' .Next()
' System.Threading.Thread.Sleep(100)
' .Next()
' System.Threading.Thread.Sleep(100)
'End With

End Sub

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button2.Click
'
'this does not play animations properly
'
m_oPPT.SlideShowWindows.Item(1).View.Next()
End Sub

Create a presentation with a few animations and see if it runs properly
for you. Thanks.

Tim
 
T

Tim

I figured out the problem. In case any one else runs into this problem,
I had to call SlideShowWindow.Activate() before calling Next().

Tim
 

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