Reputation: 121
I have an Excel macro that opens a PowerPoint file from a specified location. The PowerPoint file is a template.
I need to create a new presentation based on the template design.
My code will open the template rather than a new presentation based on that template:
Sub Open_PowerPoint_Presentation()
'Opens a PowerPoint Document from Excel
Dim objPPT As Object
Set objPPT = CreateObject("PowerPoint.Application")
objPPT.Visible = True
'Change the directory path and file name to the location
'of your document
objPPT.Presentations.Open "C:\Users\Colin\Documents\Custom Office Templates\PowerPoint Templates\Edge45 Monthly Report Template Macro.potm"
End Sub
Upvotes: 4
Views: 10179
Reputation: 743
In my opinion, you should open your template file with the Untitled
parameter (Open
method) set to true.
objPPT.Presentations.Open FileName:="MyTemplate Macro.potm", Untitled:=msoTrue
According to Presentations.Open Method (PowerPoint),
Opens the file without a title. This is equivalent to creating a copy of the file.
Upvotes: 6