Powerpoint VBA code for moving to next/previous slide from WITHIN the notes window

tjoindigo
tjoindigo used Ask the Experts™
on
Hi,

When editing the notes of my slides, I want to use a keyboard shortcut to easily move to the next or previous slide. There is no default shortcut key to do that, as far as I can find.

Right now I press F6, Down, Shift+F6. That is way to tedious for me :)

So I tried to create a macro to do this. That way, I can assign a shortcut key to that macro (like Alt+1).
Unfortunately, I cannot get this macro to work.

The easiest solution would be SendKeys "{F6}{PGDN}+{F6}". However, when I execute that macro, I end up in the notes pane of the slide that I was working on, not the next slide.

The same happens with this more elaborate macro:

With ActiveWindow
     If .ViewType = ppViewNormal And _
             .ActivePane.ViewType = ppViewNotesPage Then
         .Panes(2).Activate
     End If
 End With

 ActivePresentation.Slides(ActiveWindow.Selection.SlideRange(1).SlideIndex + 1).Select

 DoEvents

 With ActiveWindow
     If .ViewType = ppViewNormal Then
         .Panes(ppViewNotesPage).Activate
     End If
 End With


Any ideas on how to get this working would be really, really appreciated. At least by me :)

Thanks!
TJ
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Top Expert 2016
Commented:
Hi,

pls try

Sub Macro()
If ActivePresentation.Slides(ActiveWindow.Selection.SlideRange(1).SlideIndex).SlideIndex < ActivePresentation.Slides.Count Then
  With ActiveWindow
      If .ViewType = ppViewNormal And _
              .ActivePane.ViewType = ppViewNotesPage Then
          .Panes(1).Activate
      End If
  myView = .ViewType
  .ViewType = ppViewSlide
  End With

    ActivePresentation.Slides(ActiveWindow.Selection.SlideRange(1).SlideIndex + 1).Select
  With ActiveWindow
      .ViewType = myView
      If .ViewType = ppViewNormal Then
          .Panes(ppViewNotesPage).Activate

      End If
  End With
Else
  MsgBox "Last Slide"
End If
End Sub

Open in new window

Regards

Author

Commented:
Awesome, that works.
Thanks so much.
Jamie GarrochSenior Technical Consultant at BrightCarbon

Commented:
I know you've accepted a solution now but as I just wrote this in parallel, I may as well post it!

Option Explicit

Sub GotoNextSlideNote()
  Dim lCurSlide As Long
  With ActiveWindow
    If .ViewType = ppViewNormal And .ActivePane.ViewType = ppViewNotesPage Then .Panes(2).Activate
  End With
    
  With ActiveWindow
    With .View
      lCurSlide = .Slide.SlideIndex
      If lCurSlide < ActivePresentation.Slides.Count Then .GotoSlide (lCurSlide + 1) Else .GotoSlide (1)
    End With
    If .ViewType = ppViewNormal Then .Panes(ppViewNotesPage).Activate
  End With
End Sub

Open in new window

Author

Commented:
Thanks, Jamie! :)
Your solution is much faster, which helps.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial