title: Writing Excel VBA code/macro to populate Powerpoint Text boxes with Excel cell values
body: <p>I am attempting to take the value in Excel cells and populate PowerPoint text boxes. I don't want to link a PowerPoint table to an Excel spreadsheet because the spreadsheet is constantly changing and values are not always in the same rows or the same order.</p>
  
  <p>So I am writing this VBA code to try and populate the text boxes. I've done a lot of VBA, but never attempted this combination. Below is what I have thus far (more code will be put in for additional text boxes, but need to get one working first). I realize the issue has something to do with the object not being properly handled, but not sure how to correct it.</p>
  
  <p>I'm using Excel and PowerPoint 2007. The bold statement is where I receive the error - 438 object does not support this property or method.</p>
  
  <p>Thanks!</p>
  
  <pre><code> Sub valppt()
  
   Dim PPT As PowerPoint.Application
      Dim newslide As PowerPoint.Slide
      Dim slideCtr As Integer
      Dim tb As PowerPoint.Shape
      Set PPT = CreateObject("PowerPoint.Application")
      PPT.Visible = True
  
      PPT.Presentations.Open "C:\Documents\createqchart.pptx"
  
      Range("F2").Activate
      slideCtr = 1
  
      Set newslide = ActivePresentation.Slides(slideCtr).Duplicate
      Set tb = newslide.Shapes("TextBox1")
  
      slideCtr = slideCtr + 1
      ' Do Until ActiveCell.Value = ""
      Do Until slideCtr &gt; 2
          If slideCtr = 2 Then
             tb.TextFrame2.TextRange.Characters.Text = ActiveCell.Value
          End If
          ActiveCell.Offset(0, 1).Activate
          slideCtr = slideCtr + 1
  
          If slideCtr = 38 Then
              Set newslide = PPT.ActivePresentation.Slides(slideCtr).Duplicate
              ActiveCell.Offset(1, -25).Activate
          End If
  
        Loop
  
     End Sub
  </code></pre>
  
  <p>UPDATE 5/17</p>
  
  <p>While the replication of the slide works, I am still unable to value the textbox. I haven't been able to come up with the right set statement prior to the statement to have the value assigned to the textbox. Right now I don't even have a set statement in there right now, because I haven't been able to get the proper one.  Any assistance is  appreciated. Below is the latest code.</p>
  
  <pre><code>Sub shptppt()
  '
  ' shptppt Macro
  '
  
      Dim PPT As PowerPoint.Application
      Dim pres As PowerPoint.Presentation
      Dim newslide As PowerPoint.Slide
      Dim slideCtr As Integer
      Dim tb As PowerPoint.Shape
  
  
      Set PPT = CreateObject("PowerPoint.Application")
      PPT.Visible = True
  
      Set pres = PPT.Presentations.Open("C:\Documents\createqchart.pptx")
  
      Range("F2").Activate
      slideCtr = 1
  
      'Set newslide = ActivePresentation.Slides(slideCtr).Duplicate
      ' Set tb = newslide.Shapes("TextBox1")
  
  
      pres.Slides(slideCtr).Copy
      pres.Slides.Paste
      Set newslide = pres.Slides(pres.Slides.Count)
      newslide.MoveTo slideCtr + 1
  
      slideCtr = slideCtr + 1
      ' Do Until ActiveCell.Value = ""
      Do Until slideCtr &gt; 2
          If slideCtr = 2 Then
              tb.Slides.TextFrame2.TextRange.Characters.Text = ActiveCell.Value
          End If
          ActiveCell.Offset(0, 1).Activate
          slideCtr = slideCtr + 1
  
          If slideCtr = 38 Then
              Set newslide = PPT.ActivePresentation.Slides(slideCtr).Duplicate
              ActiveCell.Offset(1, -25).Activate
          End If
  
      Loop
  
  End Sub
  </code></pre>