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.
Sub Create_Presentation() Presentations.Add End Sub
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
'Create new PowerPoint Presentation and add slide Sub Create_Presentation_WithSlide_Ex2() With Presentations.Add .Slides.Add 1, 1 End With End Sub
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
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
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
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
'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
'Access a slide by its name Sub Access_Slide_ByName() ActivePresentation.Slides(2).Name = "Title" ActivePresentation.Slides("Title").Select End Sub
'Access a slide by its index number Sub Access_Slide_ByIndex() ActivePresentation.Slides(4).Select End Sub
'Start a slide show Sub Satrt_SlideShow() ActivePresentation.SlideShowSettings.Run End Sub
'Exit a slide show Sub Exit_SlideShow() ActivePresentation.SlideShowWindow.View.Exit End Sub
'Display previous side Sub Display_PreviousSlide() ActivePresentation.SlideShowWindow.View.Previous End Sub
'Display next side Sub Display_NextSlide() ActivePresentation.SlideShowWindow.View.Next End Sub
'Display first side Sub Display_FirstSlide() ActivePresentation.SlideShowWindow.View.First End Sub
'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