Reputation: 33
I want to create powerpoint presentation through VBA Code and I selected library (early binding) reference in tools also. But I'm unable to create Powerpoint application through VBA. I wrote the below code and i'm getting the error as "Class does not support automation or does not support expected interface". Could you please help to resolve the issue.
Sub CreatePPT()
Dim MYPPT As PowerPoint.Application
Set MYPPT = New PowerPoint.Application
With MYPPT
.Visible = msoTrue
.Activate
End With
End Sub
Upvotes: 0
Views: 182
Reputation: 1060
You should add a Presentation :
Sub CreatePPT()
Dim MYPPT As PowerPoint.Application
Set MYPPT = New PowerPoint.Application
Dim PPTPresent as PowerPoint.Presentation
With MYPPT
.Visible = msoTrue
set PPTPresent = .Presentations.add
End With
End Sub
Upvotes: 0