title: Macro works in step by step but not in F5 mode
body: <p>I have many shapes to copy paste from an Excel file to a PowerPoint presentation (10 slides). When I execute the macro using F8, it works, but if I execute it directly (using button or the play button - triangle-) it doesn't paste all. For example 1 shape in 1st slide ok. second slide nothing, 3rd slide half of shapes only... and not respecting the position I gave in the macro. What I can see, is, when it is running faster (by run) it is not giving time for every step to be executed until the end, so its executing a part of code and not other parts.</p>
  
  <p>PS: I do not have any error in the end.</p>
  
  <p>I tried DoEvents, but nothing changed.</p>
  
  <pre><code>Sub copierppt()
  Dim PPT As PowerPoint.Application
  Dim PptDoc As PowerPoint.Presentation
  Dim NbShpe As Byte
  Dim i As Integer
  
  Set PPT = CreateObject("Powerpoint.Application")
  PPT.Visible = True 'l'application sera visible
  Set PptDoc = PPT.Presentations.Open("D:\Users\MATRIX.pptx")
  
      '5 ###################  slide 5 ####################
      PPT.ActiveWindow.View.GotoSlide Index:=5
      ThisWorkbook.Worksheets("names").ChartObjects("names graphe1").Copy
      PPT.ActiveWindow.Panes(1).Activate
      PPT.CommandBars.ExecuteMso ("PasteSourceFormatting")
      NbShpe = PptDoc.Slides(5).Shapes.Count
      With PptDoc.Slides(5).Shapes(NbShpe)
          .Name = "names graphe1"
          .Left = 50
          .Top = 230
          .Height = 270
          '.Width = 350
      End With
      DoEvents
  
      ' 6 ###################  slides 6 ####################
      PPT.ActiveWindow.View.GotoSlide Index:=6
      ThisWorkbook.Worksheets("surmane").ChartObjects("surname graphe1").Copy
      PPT.ActiveWindow.Panes(1).Activate
      PPT.CommandBars.ExecuteMso ("PasteSourceFormatting")
      NbShpe = PptDoc.Slides(6).Shapes.Count
      With PptDoc.Slides(6).Shapes(NbShpe)
          .Name = "Open surname graphe1"
          .Left = 50
          .Top = 230
          .Height = 270
          '.Width = 350
      End With
  
      ' 7 ################### slide 7 ####################
      PPT.ActiveWindow.View.GotoSlide Index:=7
      ThisWorkbook.Worksheets("adress").ChartObjects("adress graphe1").Copy
      PPT.ActiveWindow.Panes(1).Activate
      PPT.CommandBars.ExecuteMso ("PasteSourceFormatting")
      DoEvents
      NbShpe = PptDoc.Slides(7).Shapes.Count
      With PptDoc.Slides(7).Shapes(NbShpe)
          .Name = "adress graphe1"
          .Left = 50
          .Top = 230
          .Height = 270
          '.Width = 350
      End With
  
      ' 8 ################### slide 8 ####################
      PPT.ActiveWindow.View.GotoSlide Index:=8
      ThisWorkbook.Worksheets("statut").ChartObjects("statut graphe1").Copy
      PPT.ActiveWindow.Panes(1).Activate
      PPT.CommandBars.ExecuteMso ("PasteSourceFormatting")
      NbShpe = PptDoc.Slides(8).Shapes.Count
      With PptDoc.Slides(8).Shapes(NbShpe)
          .Name = "statut graphe1"
          .Left = 50
          .Top = 240
          .Height = 300
          '.Width = 350
      End With
  
      Sheets("statut").Activate
      Sheets("statut").Range("G21").Select
      Range(Selection, Selection.End(xlToRight)).Select
      Range(Selection, Selection.End(xlDown)).Select
      Selection.Copy
  
      PPT.ActiveWindow.Panes(1).Activate
  
      PPT.CommandBars.ExecuteMso ("PasteSourceFormatting")
      NbShpe = PptDoc.Slides(8).Shapes.Count
  
      With PptDoc.Slides(8).Shapes(NbShpe)
          .Name = "TCD1"
          .Left = 88
          .Top = 205
          '.Height = 520
          '.Width = 20
      End With
  
  End Sub
  </code></pre>