Shortcuts for Presenters using PowerPoint
How to quickly move forward or back in a PowerPoint file while presenting
A person was having trouble with a macro they were trying to create for PowerPoint 2010 that would move their Slide Show presentation from one Section of slides to the next, or back, by clicking on a slide button. This might be a handy if you want to skip ahead or back quickly; kind of like fast forward or skipping chapters on a Nextflix show.
The VBA code to do this is basic, but you need two versions, one for forward and one for reverse. Each version is tied to a command button that you insert using controls on the Developer tab on PowerPoint’s ribbon and linking it to the two subroutines.
Here is the code that links the buttons to the subroutines
Option Explicit
Private Sub CommandButton1_Click()
GoToPreviousSection
End Sub
Private Sub CommandButton2_Click()
GoToNextSection
End Sub
Here is the code of the two subroutines
Option Explicit
Sub GoToNextSection()
Dim ppt As PowerPoint.Presentation
Dim sldRng As PowerPoint.SlideRange
Dim sldNbr, secCnt, secNbr As Long
Set ppt = ActivePresentation
secCnt = ppt.SectionProperties.Count
If secCnt = 0 Then Exit Sub
If ppt.SlideShowWindow.View.Slide.sectionIndex = secCnt Then
sldNbr = ppt.SectionProperties.FirstSlide(1)
Else
sldNbr = ppt.SectionProperties.FirstSlide(ppt.SlideShowWindow.View.Slide.sectionIndex + 1)
End If
ppt.SlideShowWindow.View.GotoSlide sldNbr, msoTrue
End Sub
Sub GoToPreviousSection()
Dim ppt As PowerPoint.Presentation
Dim sldRng As PowerPoint.SlideRange
Dim sldNbr, secCnt, secNbr As Long
Set ppt = ActivePresentation
secCnt = ppt.SectionProperties.Count
If secCnt = 0 Then Exit Sub
If ppt.SlideShowWindow.View.Slide.sectionIndex = 1 Then
sldNbr = ppt.SectionProperties.FirstSlide(secCnt)
Else
sldNbr = ppt.SectionProperties.FirstSlide(ppt.SlideShowWindow.View.Slide.sectionIndex - 1)
End If
ppt.SlideShowWindow.View.GotoSlide sldNbr, msoTrue
End Sub
Using his code and contrasting it to my code above, I was able to show him where he had gone astray and what was the correct coding method to accomplish his objective. However, there was more I needed to share with him because coding the VBA macros might only be necessary in some very special cases.
You see… PowerPoint has a built-in function that allows the Presenter to skip forward or backward based on Slide Numbers or Section Names. While you are running the presentation in the Show Slide view, on the PC:
A keystroke shortcut of Shift-F10-G brings up a contextual menu with the slides listed by slide number and their Title, as long as one exists on the slide. Select the slide and you go to it immediately.
A keystroke of Shift-F10-T opens the contextual menu for skipping forward or backward based on Section Name. Selecting one brings you immediately to the first slide of that Section. And just the shortcut of Shift-F10 alone provides the contextual menu for all options available to the presenter.
On the Mac in PowerPoint 2011 the keystroke shortcut is a Ctrl-Click (AKA right click) on the displayed image. This opens the contextual menu, but unfortunately, even though Sections are supported in Mac PowerPoint 2011, a contextual menu shortcut is not provided so this is one of the special cases where you need the VBA code.