With the following code I either get an open blank PPT presentation with the generic template. if I set it top open my custom template it opens the template or "Master View." How do I get it to open a new PPT with my template? This is a start as I will get into formatting later on.
Code:
Sub cmdPowerPoint_Click()
Dim db As DAO.Database
Dim rst As DAO.Recordset
Dim ppObj As PowerPoint.Application
Dim ppPres As PowerPoint.Presentation
Dim sTemplate As String
On Error GoTo ErrorMsgs
Set db = CurrentDb
Set rs = db.OpenRecordset("Weekly Closed", dbOpenDynaset)
Set ppObj = New PowerPoint.Application
'Set ppPres = ppObj.Presentations.Open("C:\Users\username\Documents\Custom Office Templates\Weekly Closed.potx") 'This opens in "Master View"
Set ppPres = ppObj.Presentations.Add 'This opens the generic presentation
With ppPres
While Not rs.EOF
With .Slides.Add(rs.AbsolutePosition + 1, ppLayoutTitle)
.Shapes(1).TextFrame.TextRange.Text = "Weekly Closed CR's"
'.SlideShowTransition.EntryEffect = ppEffectFade
With .Shapes(2).TextFrame.TextRange
.Text = CStr(rs.Fields("[Change Requested]").Value)
'.Characters.Font.Color.RGB = RGB(255, 0, 255)
'.Characters.Font.Shadow = True
End With
.Shapes(1).TextFrame.TextRange.Characters.Font.Size = 20
End With
rs.MoveNext
Wend
End With
Exit Sub
ErrorMsgs:
err_cmdOLEPowerPoint:
MsgBox Err.Number & " " & Err.Description
End Sub