I am using VBA code in Excel to create a slide in PowerPoint for each row of the spreadsheet. The following code works correctly in opening a new presentation and creating a new slide for each row as highlighted in my spreadsheet. It places the 1st cell of the row within the Title placeholder of the new slide:
Sub LoopRowsSelected()
Dim DataRange As Range
Dim DataRow As Range
Dim DataColumn As Range
Dim AppPPT As PowerPoint.Application
Dim Prs As PowerPoint.Presentation
Dim Sld As PowerPoint.Slide
Set AppPPT = New PowerPoint.Application
Set Pres = AppPPT.Presentations.Open("C:\Test\Sample.potx")
AppPPT.Visible = True
Set DataRange = Selection
For Each DataRow In DataRange.Rows
Set Sld = Pres.Slides.AddSlide(Pres.Slides.Count + 1, Pres.SlideMaster.CustomLayouts(1))
Sld.Shapes.Title.TextFrame.TextRange.Text = DataRow.Cells(1, 1)
Next DataRow
End Sub
I had thought by naming each placeholder within the template differently, and then by copying this line:
Sld.Shapes.Title.TextFrame.TextRange.Text = DataRow.Cells(1, 1)
And adding it to look like this:
Sld.Shapes.Description.TextFrame.TextRange.Text = DataRow.Cells(1, 2)
It would insert the second cell of the row into the placeholder named "Description". It comes back with an error stating "Compile error: Method or data member not found". Obviously, I'm barking up the wrong tree in thinking "Title" is the actual "Title" selection object name in the template.
My question is, what do I need to do differently to direct the cell contents to the correct placeholder in the PPT template? Mind you (as you've already figured out), I'm not a programming, VBA, or Excel expert. I do not have a very good understanding of methods and hierarchy of elements, which I'm sure is causing me issues.