MS PowerPoint VBA Interview Questions and Answers with Examples

MS PowerPoint VBA Interview Questions and Answers explained with Example macros. Here are the list of most frequently asked basic MS PowerPoint VBA interview questions. All the questions are answered with simple examples. These questions will help you to answer basic questions to deal with MS PowerPoint VBA Programming/Development.

Here is the following VBA procedure or macro to create new PowerPoint Presentation.

Sub Create_Presentation()
    Presentations.Add
End Sub
Here is the following VBA procedure or macro to add slide in a presentation.

Sub Create_Presentation_WithSlide_Ex1()
    With Presentations.Add
    .Slides.Add Index:=1, Layout:=ppLayoutTitle
    End With
End Sub

'Or

Sub Create_Presentation_WithSlide_Ex2()

    With Presentations.Add
    .Slides.Add 1, 1
    End With

End Sub
Here is the following VBA procedure to create new PowerPoint Presentation and add slide.

'Create new PowerPoint Presentation and add slide
Sub Create_Presentation_WithSlide_Ex2()

    With Presentations.Add
    .Slides.Add 1, 1
    End With

End Sub
Here is the following macro to save PowerPoint Presentation.

Sub Create_Save_Presentation()
    
    'Variable Declaration
    Dim NewPres As Presentation
    
    'Create new Presentation
    Set NewPres = Presentations.Add
    
    'Your statements do something
    
    'Save Presentation in a folder
    NewPres.SaveAs FileName:="d:/TestPresentation.pptx"
    
End Sub
Here is the following macro to delete 1st slide in a PowerPoint Presentation.

Example 1:

Sub DeleteSlide_Presentation_Ex1()
    ActivePresentation.Slides(1).Delete
End Sub

Example 2:

'Delete 3rd slide in a presentation
Sub DeleteSlide_Presentation_Ex2()
    ActivePresentation.Slides(3).Delete
End Sub
Here is the following code to duplicate 1st slide in a presentation.
Example 1:

'Duplicate 1st slide in a presentation
Sub DuplicateSlide_Presentation_Ex1()
    ActivePresentation.Slides(1).Duplicate
End Sub

Example 2:

'Duplicate 3rd slide in a presentation
Sub DuplicateSlide_Presentation_Ex2()
    ActivePresentation.Slides(3).Duplicate
End Sub
Here is the following code to move slide from position one to three in a presentation.

Example 1:

'Move slide from position one to three in a presentation
Sub Move_Slide_Ex1()
    ActivePresentation.Slides(1).MoveTo topos:=3
End Sub

Example 2:

'Move slide from position four to two in a presentation
Sub Move_Slide_Ex2()
    ActivePresentation.Slides(4).MoveTo topos:=2
End Sub
Here is the following code to copy slide and Paste it in another location in a presentation.

'Copy third slide and Paste it as a first slide in a presentation
Sub CopyPaste_Slide()
    ActivePresentation.Slides(3).Copy
    ActivePresentation.Slides.Paste Index:=1
End Sub
Here is the following code to access a slide by its name in a presentation.

'Access a slide by its name
Sub Access_Slide_ByName()
    ActivePresentation.Slides(2).Name = "Title"
    ActivePresentation.Slides("Title").Select
End Sub
Here is the following code to access a slide by its index number in a presentation.

'Access a slide by its index number
Sub Access_Slide_ByIndex()
    ActivePresentation.Slides(4).Select
End Sub
Here is the following procedure to start a slide show.

'Start a slide show
Sub Satrt_SlideShow()
    ActivePresentation.SlideShowSettings.Run
End Sub
Here is the following procedure to exit a slide show.

'Exit a slide show
Sub Exit_SlideShow()
    ActivePresentation.SlideShowWindow.View.Exit
End Sub
Here is the following procedure to display previous side in a presentation.

'Display previous side
Sub Display_PreviousSlide()
    ActivePresentation.SlideShowWindow.View.Previous
End Sub
Here is the following procedure to display next side in a presentation.

'Display next side
Sub Display_NextSlide()
    ActivePresentation.SlideShowWindow.View.Next
End Sub
Here is the following procedure to display first side in a presentation.

'Display first side
Sub Display_FirstSlide()
    ActivePresentation.SlideShowWindow.View.First
End Sub
Here is the following procedure to display last side in a presentation.

'Display last side
Sub Display_lastSlide()
    ActivePresentation.SlideShowWindow.View.Last
End Sub

Here is the link for more VBA Interview Questions and Answers. These are explained for examples.
100+ VBA Interview Questions