title: Powerpoint VBA: Loop to make textboxes visible gets issues when adding bring to front
body: <p>So I have written the following code to make the textboxes in my presentation visisible and then bring them to the front (they are made invisible by a separate macro):</p>
  
  <pre><code>Dim oSld As Slide
  Dim oShp As Shape
  Dim oPPT As Presentation
  
  For Each oSld In ActivePresentation.Slides
  For Each oShp In oSld.Shapes
  
  If oShp.Type = msoTextBox Then
          oShp.Visible = True
          oShp.ZOrder msoBringToFront
  End If
  
  Next oShp
  Next oSld
  </code></pre>
  
  <p>It worked perfectly before I added the bring to front command! Now only around half of the shapes are made visible when the code is run. I've been reading around online and it appears that ZOrder changes the number of shapes and that is why only some are made visible.... but cannot work out a way around it! Would really appreciate some help!</p>