How can I get the SlideIndex of a visible Slide in Powerpoint when SelectionType = ppSelectionNone

Potential workaround, here:

http://eileenslounge.com/viewtopic.php?f=30&t=1667

If ActiveWindow.Selection.Type = ppSelectionNone Then
  Select Case ActiveWindow.ViewType
    Case ppViewNormal
      ActiveWindow.ViewType = ppViewSlide
      ActiveWindow.ViewType = ppViewNormal
    Case ppViewSlideSorter
      ActiveWindow.ViewType = ppViewSlide
      ActiveWindow.ViewType = ppViewSlideSorter
    Case Else
      ' ?
  End Select
End If
' A slide should be selected now

I don't particularly care for it, aesthetically, but it seems to work, kind of. Only thing is normallly if selection is between to slides, this forces selection to the first of those two slides, when I think the second would be more intuitive. I can modify my code to account for this, but it's still not ideal.


David, maybe you could use additionally Activate method for Window.Pane object like this:

'new code:
ActivePresentation.Windows(1).Panes(2).Activate
'your code
Dim w as Long 'slide index variable
w = ActivePresentation.Windows(1).Selection.SlideRange(1).SlideIndex

However, please read some more about Pane.ViewType property which could be helpful. In my simple test both Panes(2) and Panes(3) works but you could have different context of calling your sub.

Tags:

Vba

Powerpoint