' Add a new slide (Title and Subtitle layout)
Dim slide As Object
Set slide = pres.Slides.Add(slideIndex, 1)
' Set title and subtitle
slide.Shapes(1).TextFrame.TextRange.Text = title
slide.Shapes(2).TextFrame.TextRange.Text = subtitle
End Sub
Sub CreatePresentation()
Dim ppt As Object
Dim pres As Object
Dim slideIndex As Integer
' Create a new PowerPoint application and presentation
Set ppt = CreateObject("PowerPoint.Application")
Set pres = ppt.Presentations.Add
ppt.Visible = True
' Initialize slideIndex
slideIndex = 1
' Slide 1: Introduction
CreateSlide pres, "Introduction", _
"An overview of the topic and key points to be discussed in the presentation.", slideIndex
slideIndex = slideIndex + 1
' Slide 2: Information
CreateSlide pres, "Information", _
"Detailed insights and data on the subject, providing context and analysis.", slideIndex
slideIndex = slideIndex + 1
' Slide 3: Key Insights
CreateSlide pres, "Key Insights", _
"Summary of important findings, trends, and takeaways.", slideIndex
slideIndex = slideIndex + 1
' Slide 4: Conclusion
CreateSlide pres, "Conclusion", _
"Final thoughts, implications, and potential future considerations.", slideIndex
slideIndex = slideIndex + 1
' Slide 5: References
CreateSlide pres, "References", _
"Citations and sources used to support the information presented.", slideIndex
End Sub
Last active
May 6, 2025 14:05
-
-
Save animegamer4422/243d5a96ffe372cc03d6fe9e4080b8ff to your computer and use it in GitHub Desktop.
PPT VBA Script
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Instructions to Use VBA Code in Excel for PowerPoint Presentation
Enabling Developer Mode in Excel
To use VBA in Excel, you need to enable the Developer tab. Follow these steps:
The Developer tab should now appear in the Excel ribbon.
Using the VBA Code in Excel
Step 1: Open the VBA Editor
ALT + F11to open the VBA Editor.Step 2: Copy and Paste the Code
Step 3: Run the Code
CreatePresentationfrom the list.Step 4: Viewing the PowerPoint Presentation
Now, you have a fully automated process to generate a PowerPoint presentation using Excel VBA!