Quantcast
Channel: Excel IT Pro Discussions forum
Viewing all articles
Browse latest Browse all 11829

Writing Excel VBA code/macro to populate Powerpoint Text boxes with Excel cell values

$
0
0

So I am writing VBA code to populate the text boxes...or attempting to. 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.

I'm using Excel and PowerPoint 2007. The bolded statement is where I receive the error - 438 object does not support this propery or method.

Thanks!

Sub valppt()

Dim PPT As Object
Dim newslide As Object
Dim slideCtr As Integer

Set PPT = CreateObject("PowerPoint.Application")
PPT.Visible = True

PPT.Presentations.Open "C:\Users\drew.sarver\Documents\createqchart.pptx"

Range("F2").Activate
slideCtr = 2
Set newslide = PPT.ActivePresentation.Slides(slideCtr).Duplicate
Do Until ActiveCell.Value = ""
    If slideCtr = 2 Then
        PPT.txtReqBase.Value = ActiveCell.Value
    End If
    If slideCtr = 3 Then
        PPT.txtReqCurr.Value = 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


Viewing all articles
Browse latest Browse all 11829

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>