Hello Shyam,
Thank you for the quick response. We could partially solve the problem
(Please find the details furninshed below on this method).
We have uploaded the test presentation to the following location:
http://rapidshare.de/files/4284264/WithPrevAnime.ppt.html
Office versions on which we tested the code:
PowerPoint 2002 (SP1),PowerPiont 2003
We created a new presentation using AutoContent Wizard (Corporate - Employee
orientation). We deleted all the slides except the first four. Placed a
button on the 2nd slide. Wrote the following VBA code in the button's event
handler.
Private Sub CommandButton1_Click()
ActivePresentation.Slides(2).Shapes.AddPicture FileName:="D:\desert_01.jpg",
LinkToFile:=msoFalse, SaveWithDocument:=msoTrue, Left:=10, Top:=10,
Width:=200, Height:=100
End Sub
Ran the slide show. When we click on the button on the 2nd slide, the image
gets inserted. But at this time the animations are played again. We do not
want the animation being played when we click on this button. We tried
AnimationSettings::Animate property. It prevents the animation from being
played during the image insertion. But we cannot turn on the previous
animation settings. Please find the VBA below that we tried.
Private Sub CommandButton1_Click()
Dim num As Integer
num = ActivePresentation.Slides(2).Shapes.Count
'Turn off all the animation settings so that they wont reanimate during
image insertion
For i = 1 To num
ActivePresentation.Slides(2).Shapes(i).AnimationSettings.Animate =
msoFalse
Next i
ActivePresentation.Slides(2).Shapes.AddPicture FileName:="D:\desert_01.jpg",
LinkToFile:=msoFalse, SaveWithDocument:=msoTrue, Left:=10, Top:=10,
Width:=200, Height:=100
'Image insertion over - reset animation settings
'This throws error
For i = 1 To num
ActivePresentation.Slides(2).Shapes(i).AnimationSettings.Animate = msoTrue
Next i
End Sub
Or do we need to store each and every detail of each animated object before
turning off the animation? Is there any other easy way?
Can we prevent the animation being played during this image insertion using
any other method so that we can easily reset the previous aniamtions
settings?
Thank you,
Prashob.