Sub CreateBasicPPT()
' Declare variables
Dim pptApp As Object
Dim pptPres As Object
Dim slideIndex As Integer
' Create a new instance of PowerPoint
Set pptApp = CreateObject("PowerPoint.Application")
pptApp.Visible = True ' Show PowerPoint application
' Create a new presentation
Set pptPres = pptApp.Presentations.Add
' Add a title slide
slideIndex = slideIndex + 1
With pptPres.Slides.Add(slideIndex, ppLayoutTitle)
.Shapes(1).TextFrame.TextRange.Text = "My Basic Presentation"
.Shapes(2).TextFrame.TextRange.Text = "Subtitle"
End With
' Add a content slide
slideIndex = slideIndex + 1
With pptPres.Slides.Add(slideIndex, ppLayoutText)
.Shapes(1).TextFrame.TextRange.Text = "Introduction"
.Shapes(2).TextFrame.TextRange.Text = "This is a basic PowerPoint presentation created using VBA."
End With
' Release PowerPoint objects
Set pptPres = Nothing
Set pptApp = Nothing
End Sub