title: Add audio clip via VBA to PowerPoint Presentation that spans multiple slides
body: <p>To play an audio clip inserted as a shape across multiple slides in a presentation, there is an option in the <strong>Play Sound</strong> dialog in the <strong>Effect</strong> tab called <strong>Stop playing</strong> and this can be set to <strong>After __ slides</strong>.</p>
  
  <p>I've browsed the object model and even attempted recording a macro using ppt 2003 (the option does not record).  How (if it can) can this option be set via <strong>VBA</strong>?</p>
  
  <p><img src="https://i.stack.imgur.com/Heivt.png" alt="Stop Playing After __ slides option"></p>
  
  <p>The way I'm currently adding a sound (that stops after the slides are advanced) is:</p>
  
  <pre><code>Dim oSlide As Slide
  Dim oShp As Shape
  Dim oEffect As Effect
  
  Set oSlide = ActivePresentation.Slides(2)
  
  Set oShp = oSlide.Shapes.AddMediaObject("C:\MyAudioClip.wav", True, False, 10, 10)
  
  Set oEffect = oSlide.TimeLine.MainSequence.AddEffect(oShp, msoAnimEffectMediaPlay, , msoAnimTriggerWithPrevious)
  oEffect.MoveTo 1
  </code></pre>