You are on page 1of 1

Certainly!

Here's a simple VBA code snippet that you can use to create a PowerPoint
presentation for a book review of "Wings of Fire":

```vba
Sub CreateBookReviewPresentation()
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
AddSlideWithTitleAndSubtitle pptPres, "Wings of Fire", "Book Review"

' Add content slides


slideIndex = slideIndex + 1
AddSlideWithTitleAndContent pptPres, "Author", "A.P.J. Abdul Kalam"

slideIndex = slideIndex + 1
AddSlideWithTitleAndContent pptPres, "Genre", "Autobiography"

slideIndex = slideIndex + 1
AddSlideWithTitleAndContent pptPres, "Summary", "Provide a brief summary of the
book here."

' Add a closing slide


slideIndex = slideIndex + 1
AddSlideWithTitleAndSubtitle pptPres, "Thank You", "Any Questions?"
End Sub

Sub AddSlideWithTitleAndSubtitle(pptPres As Object, titleText As String,


subtitleText As String)
Dim slide As Object
Set slide = pptPres.Slides.Add(slideIndex, ppLayoutTitle)
slide.Shapes(1).TextFrame.TextRange.Text = titleText
slide.Shapes(2).TextFrame.TextRange.Text = subtitleText
End Sub

Sub AddSlideWithTitleAndContent(pptPres As Object, titleText As String, contentText


As String)
Dim slide As Object
Set slide = pptPres.Slides.Add(slideIndex, ppLayoutText)
slide.Shapes(1).TextFrame.TextRange.Text = titleText
slide.Shapes(2).TextFrame.TextRange.Text = contentText
End Sub
```

This code creates a PowerPoint presentation with a title slide, slides for author,
genre, summary, and a closing slide. You can customize the content by modifying the
appropriate sections of the code. Ensure that you have the PowerPoint application
open before running the code.

You might also like