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

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
tjoindigoAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Rgonzo1971Commented:
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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
tjoindigoAuthor Commented:
Awesome, that works.
Thanks so much.
Jamie GarrochSenior Technical Consultant at BrightCarbonCommented:
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

tjoindigoAuthor Commented:
Thanks, Jamie! :)
Your solution is much faster, which helps.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
VB Script

From novice to tech pro — start learning today.