title: Macro from Excel Cells to Powerpoint tables
body: <p>I'm attempting to take values from Excel cells and populate PowerPoint text tables.</p>
  
  <p>Below is what I have thus far leveraging a previous macro, but I am not sure that I am on the right track.</p>
  
  <pre><code>Private Sub CommandButton1_Click()
  
      Dim sourceXL As Excel.Application
      Dim sourceBook As Excel.Workbook
      Dim sourceSheet As Excel.Worksheet
      Dim myPres As Presentation
      Dim row_excel As Integer
      Dim construindo As Integer
      Dim mantidos As Integer
      Dim contador As Integer
      Dim numero As Integer
      Dim chave As Integer
  
  
      Set sourceXL = Excel.Application
      Set sourceBook = sourceXL.Workbooks.Open(TextBox1.Value)
      Set sourceSheet = sourceBook.Sheets(4)
      Set myPres = ActivePresentation
  
      row_excel = Int(TextBox4.Value)
      construindo = Int(TextBox3.Value)
      mantidos = Int(TextBox5.Value)
  
      chave = 0
  
      If construindo = myPres.Slides.Count Then
          chave = 1
      End If
  
      While sourceSheet.Cells(row_excel, 1) &lt;&gt; "" 'loop for row in excel source
  
          myPres.Slides(construindo).Shapes(3).Table.Cell(2, 1).Shape.TextFrame.TextRange.Text = sourceSheet.Cells(row_excel, 2)
          myPres.Slides(construindo).Shapes(3).Table.Cell(4, 1).Shape.TextFrame.TextRange.Text = sourceSheet.Cells(row_excel, 5)
          ActivePresentation.Slides(construindo).Duplicate
          construindo = construindo + 1
  
          row_excel = row_excel + 1
  
      Wend
  
      numero = myPres.Slides.Count
  
      If numero &gt; construindo Then
          For contador = 1 To (numero - construindo - mantidos + 1)
              myPres.Slides(construindo).Delete
          Next contador
      End If
  
      If chave = 1 Then
          myPres.Slides(myPres.Slides.Count).Delete
      End If
  
      sourceBook.Close
  
  End Sub
  
  Private Sub TextBox1_Change()
  
  End Sub
  </code></pre>
  
  <hr>
  
  <p>run time error 13 :Type Mismatch</p>
  
  <p><img src="https://i.stack.imgur.com/i7hFL.jpg" alt="enter image description here"></p>