title: Is there a direct way to get the index of a slide in a PowerPoint presentation?
body: <p>I am trying to programmatically copy a slide in a PowerPoint presentation, and paste it right after the original.</p>
  
  <p>My first thought was to get the index of the old slide, and add the copy at the desired new index, but I can't seem to find a straightforward way to retrieve that index. I expected to have something like <code>Slides.IndexOf(Slide slide)</code>, but couldn't find anything like that. I ended up writing the very old-school following code, which seems to work, but I am curious as to whether there is a better way to do this.  </p>
  
  <pre><code>var slide = (PowerPoint.Slide)powerpoint.ActiveWindow.View.Slide;
  var slideIndex = 0;
  for (int index = 1; index &lt;= presentation.Slides.Count; index++)
  {
      if (presentation.Slides[index] == slide)
      {
          slideIndex = index;
          break;
      }
  }
  </code></pre>
  
  <p>This is C#/VSTO, but any input that could put me on the right path is appreciated, be it VBA or VB!</p>