Below is code that will title slides in a powerpoint presentation, from an a list in an excel spreadsheet. Every time this code is run, a new PPT is created; what I would like to happen is for new slides to be added in an existing PPT presentation (Active Presentation) instead of a creating a new presentation. Any help is appreciated since i'm not a vba guru yet. Thanks!
Code
Sub Createslides()
Application.ScreenUpdating = False
Dim i As Long
Dim wk As Worksheet
Dim lastrow As Long
Dim pp As PowerPoint.Application
Dim PPPres As PowerPoint.Presentation
Dim PPSlide As PowerPoint.Slide
Dim xlwksht As Excel.Worksheet
Dim MyRange As String
Dim MyTitle As String
Dim Slidecount As Long
lastrow = ThisWorkbook.Sheets("table of contents").Cells(Rows.Count, 1).End(xlUp).Row
Set pp = New PowerPoint.Application
Set PPPres = pp.Presentations.Add
pp.Visible = True
For i = 2 To lastrow
ThisWorkbook.Sheets("table of contents").Select
Application.Wait (Now + TimeValue("0:00:1"))
MyTitle = ThisWorkbook.Sheets("table of contents").Cells(i, 1)
Slidecount = PPPres.Slides.Count
Set PPSlide = PPPres.Slides.Add(Slidecount + 1, ppLayoutTitleOnly)
PPSlide.Select
PPSlide.Shapes.Title.TextFrame.TextRange.Text = MyTitle
Next i
pp.Activate
Set PPSlide = Nothing
Set PPPres = Nothing
Set pp = Nothing
Application.ScreenUpdating = True
End Sub
Display More