title: Trying to delete tables from active ppt slide
body: <p>I'm trying to delete tables from the active slide in a ppt presentation, but I can only get it to work if I specify the number for the slide. I want this to work for whatever slide is active, not a specific slide. The below code is set to delete tables from slide 3.</p>
  <pre><code>Sub CopytoPPT()
  
      Dim rng As Excel.Range
      Dim sl As PowerPoint.Slide, sl_cnt As Long, pr As Object, pr_name As String, ppt As Object
          Dim i As Long, j As Long
      Set ppt = GetObject(, &quot;PowerPoint.Application&quot;)
          Set pr = ppt.Presentations(1)
  
      Set sl = pr.Slides(3)
      For i = sl.Shapes.Count To 1 Step -1
      ' ADD THIS TEST
      If IsTable(sl.Shapes(i)) Then
        sl.Shapes(i).Delete
      End If
      Next i
      End Sub
      
      Function IsTable(oSh As Variant) As Boolean
          
          If oSh.Type = msoPlaceholder Then
              If oSh.PlaceholderFormat.ContainedType = msoTable Then
                  IsTable = True
              End If
          Else
              If oSh.HasTable Then
                  IsTable = True
              End If
              End If
      End Function
  </code></pre>