I am trying to open a PowerPoint file through Excel VBA.
I get
run-time error -2147467259 (80004005)
method 'open' of object 'Presentation Failed'
This is the code
Sub createPPT(data As Workbook, ByVal pptpath As String)
Dim Sh As Shape
Dim PP As Object
Dim PPpres As Object
'Create a PP application and make it visible
Set PP = New PowerPoint.Application
PP.Visible = msoCTrue
Set PPpres = PP.Presentations.Open(pptpath)
Set Sh = data.Worksheets("Overall_Role").Shapes("Chart 3")
Sh.Copy
PPpres.Slides(6).Shapes.Paste
Set Sh = Nothing
Set PP = Nothing
Set PPpres = Nothing
End Sub
It shows the error on
Set PPpres = PP.Presentations.Open(pptpath)