title: Copy range from Excel to PPT in VBA
body: <p>I am trying to copy and paste a range in excel to ppt as a table by using the Powerpoint macro below.  For some reason it won't allow me to paste in ppt the way I have the code written and I am very confused why. Any help with this would be greatly appreciated.</p>
  
  <pre><code>Public Sub RangeToPresentation(ByVal sheetName As String, NamedRange As Excel.Range)
      Dim ppApp As Object
      Dim ppPres As Object
      Dim PPSlide As Object
  
      Set ppApp = GetObject(, "Powerpoint.Application")
  
      Set ppPres = ppApp.ActivePresentation
      ppApp.ActiveWindow.ViewType = ppViewNormal
  
      ' Select the last (blank slide)
      Dim longSlideCount As Integer
      longSlideCount = ppPres.Slides.Count
      ppPres.Slides(1).Select
  
      Set PPSlide = ppPres.Slides(ppApp.ActiveWindow.Selection.SlideRange.SlideIndex)
  
  
      NamedRange.Copy
  
      ' Paste the range
      PPSlide.Paste.Select
  End Sub
  </code></pre>