PDA

View Full Version : [SOLVED:] Replicate template presentation with list of names in excel



kauffmac
04-03-2018, 08:23 PM
Hi All,

Relatively new to VBA in ppt 2013, have previously only used in excel. I have a template presentation that I need to replicate 100 times for different individuals, with only slight changes to each presentation. If I have a standardized list of names in excel (e.g. FirstName + LastName concatenated into one column), is there a way to:

1. Create a new copy of the template ppt presentation for each individual and save to the same folder/path (e.g. "PresentationTitle_LASTNAME_FIRSTNAME.pptx); and
2. Insert that individual's name on the title slide as well (title page template attached)?

The desired end result would be 100 presentations saved to the same destination with each individuals' name in both the file name and on the title page.

Many thanks in advance for any guidance with this.

John Wilson
04-03-2018, 11:23 PM
Do it in Excel VBA then (Create a ref to PowerPoint)

Loop through the names and use them like this


Sub makePres()
Dim pptpres As PowerPoint.Presentation
Dim pptapp As PowerPoint.Application
Dim firstName As String
Dim lastName As String
Set pptapp = CreateObject(Class:="PowerPoint.Application")
Set pptpres = pptapp.Presentations.Open("C:\Users\johns\Desktop\Presentation A.pptx")
'FOR LOOP to get names
'just example
firstName = "John"
lastName = "Wilson"


pptpres.Slides(1).Shapes.Title.TextFrame.TextRange = lastName & " " & firstName
Debug.Print pptpres.Path & "\" & firstName & "_" & lastName & ".pptx"
pptpres.SaveCopyAs pptpres.Path & "\" & firstName & "_" & lastName & ".pptx"
'NEXT




End Sub

Note this is just a pointer not intended to be robust debugged code!