title: Powerpoint VBA Loop not looping through all slides
body: <p>Bit of an issue, I have some VBA code that loops through all of the sheets in my ppt, loops through all of the shapes in each ppt, and deletes the ppt if a specific string of text is not found. It seems to work perfectly other than the code seems to stop looping for no reason. I have to hit F5 about 4 times for the code to loop through all the sheets. It could be something to do with my code so I thought I'd try the good people of Stackoverflow first.</p>
  
  <pre><code>Public Sub ExportMBR()
  Dim oSld As Slide
  Dim oShp As Shape
  Dim strSearch As String
  Dim i As Integer
  
  strSearch = "R&amp;T MBR"
  i = 0
  
  For Each oSld In ActivePresentation.Slides
      Debug.Print (ActivePresentation.Slides.Count)
      Debug.Print (oSld.Name)
      For Each oShp In oSld.Shapes
          If oShp.HasTextFrame Then
              If oShp.TextFrame.TextRange.Find(strSearch) Is Nothing Then
              Else
                  Debug.Print (oSld.Name &amp; " Slide found")
                  i = i + 1
              End If
          End If
      Next oShp
      If i = 0 Then
          Debug.Print (oSld.Name &amp; " Deleting")
          oSld.Delete
          i = 0
      End If
      i = 0
  Next oSld
  
  myQ = "&lt;afilepath&gt;"
  myName = myQ &amp; "&lt;anameformat&gt;") &amp; ".pptx"
  ActivePresentation.SaveCopyAs myName
  
  Call Shell("explorer.exe " &amp; myQ, vbNormalFocus)
  
  End Sub
  </code></pre>
  
  <p>There are 34 slides in my ppt, each run will loop through about 7 slides correctly identifying and deleting the slides I do not need, but then without any errors it will just stop looping and continue executing the rest of the code. The string is found on slides 17 and 18 if this makes a difference. I have added few bits extra to try and solve the problem like the debug.prints and the i = 0 but I just can't figure out what I'm doing wrong.</p>
  
  <p>Many thanks in advance!</p>
  
  <p>ppw</p>