0

I have a simple slideshow, with many slides. When I tried to add a sound effect with VBA to certain shapes for some reason animations are getting messed, some of them are disappeared at all.

I have simplified the sub down to one line:

     Sub change_sound()
         ActivePresentation.Slides(4).Shapes(3).AnimationSettings.SoundEffect.ImportFromFile "C:\Users\besik.ghviniashvili\Desktop\MacroABC\audio\kalia.wav"
     End Sub

After I run this only line of code, the animations are transformed, durations are changed, motion paths and exit animations are cleared at all, and the animation on which i am trying to apply sound is changed from "float in" to "appear", but the sound effect is added to the animation.

I noticed that, if i add the same sound manually and run the same code nothing bad happens and with other sound file the animations are messing as usual. I tried moving sound files to other folder but nothing changed.

Martijn Pieters
  • 1,048,767
  • 296
  • 4,058
  • 3,343
Bes Gh
  • 13
  • 5
  • I can't reproduce any such effect from your description. If it's only one presentation that has this problem, it could be some construction problem or file corruption. – John Korchok Aug 14 '19 at 18:04
  • it's easy to replicate, just create a blank presentation, add shapes. than add any of the emphasis, exit and motion paths animations to that shapes and run the code `ActivePresentation.Slides(1).Shapes(1).AnimationSettings.SoundEffect.ImportFromFile "D:\aTi.wav"` animations will dissapear. it's acting like a bug, but there might be something that i'm missing – Bes Gh Aug 15 '19 at 06:19
  • Of course, I already tried that before I posted. As I said, I can't reproduce it. Please try with a fresh file to see if it happens again. If it does, try repairing your Office installation: https://support.office.com/en-us/article/repair-an-office-application-7821d4b6-7c1d-4205-aa0e-a6b40c5bb88b – John Korchok Aug 15 '19 at 15:08
  • if you tried that and did not happend what i've written, then your suggestion is correct, whole instalation has a problem... thanks a lot – Bes Gh Aug 16 '19 at 07:25
  • Asking if this was resolved? See related question at https://stackoverflow.com/questions/74615971/adding-sound-effects-to-macro-generated-ppt-slides-causes-animations-to-change-a. – Laminator Dec 09 '22 at 16:38
  • yes, I have used "AddMediaObject2" – Bes Gh Dec 14 '22 at 06:59

0 Answers0