0
votes

I have a PowerPoint loaded with VBA and quite a few slides. I would like to be able to manually advance the slides by pressing the {Page Down} key when I am the user running the presentation, but, I want the {Page Down} key not to work when any other user is running the presentation.

I know the following:

  1. I have a function that easily will return the name of the user, so, I can easily compare the current user to myself and execute code based on the match/lack of match. No problem here.
  2. I know that I can set the presentation type by using: ActivePresentation.SlideShowSettings.ShowType = ppShowTypeSpeaker.
  3. I know that I can set the way slides are advanced by using: ActivePresentation.SlideShowSettings.AdvanceMode = ppSlideShowManualAdvance

The problem and things I've tried:

  1. Once the PowerPoint has started, using VBA code to change the value of ShowType from the default setting of ppShowTypeKiosk to ppShowTypeSpeaker does not seem to change the way the rest of the show functions.
  2. Once the PowerPoint has started, using VBA code to change the value of AdvanceMode to ppSlideShowManualAdvance does not actually enable me to manually advance slides (I am still only able to advance slides using the ActiveX buttons on the slide).
  3. I have thought about using event handling to capture the SlideShowBegin event, but, apparently events can only be trapped once code has established the link to the Application object, and, making that link has to happen in code that runs by clicking an ActiveX control (or similar user action) in an already-running slideshow so I am baffled how the SlideShowBegin event would ever be trapped without an AddIn with an Auto_Open macro.

Bottom line: Is there a way for PowerPoint VBA code to switch a slideshow from kiosk to speaker mode so that slides can be manually advanced? (Or, some other way to enable me to manually advance slides while preventing all other users from manually advancing slides?)

1
Have you tried coding up something to a) end the slide show, b) change the slideshow mode, then c) re-start the slide show.Steve Rindsberg
Ah! Of course! Thank you, @SteveRindsberg. That did the trick. There is a ridiculously long delay between when the code to end/restart the slideshow runs and when it actually restarts, but, it does work. Please submit as answer and I'll mark it as such.DRC
Glad it helped, but better yet, submit the working code as an answer so we can help someone else further along more directly.Steve Rindsberg

1 Answers

0
votes

Thanks to @SteveRindsberg, the fix is to (a) determine whether or not to switch presentation modes, then, (b) if a switch is needed, run the code to change the settings, then, (c) programmatically end the slideshow, then, (d) programmatically run the code to re-start the slideshow.

It is assumed that the PowerPoint has been saved to run in Kiosk mode by default so that the standard user cannot use PageDown or other navigation techniques to move through slides; that is, slides can only be navigated by the programmer's ActiveX controls that use VBA code to move through the slideshow. (This is handy for quiz-type slideshows, etc.)

Specifically, I have Slide 1 which includes an ActiveX [OK] button on it which the user is directed to click in order to continue; basically, Slide 1 is a title slide that gives the name of the PowerPoint. When the OK button is clicked, the code behind the [OK] button checks to see whether the user should be allowed to change the presentation mode from the default Kiosk mode to Speaker mode. Here's the code behind the [OK] button in Slide 1:

Private Sub cmdFeedbackOK_Click()
'handle the click of the OK button on the feedback which will move to the next slide or exit if the wrong OS or Office Version (based on text associated with the [OK] button
'check for superuser
If LCase(Environ("UserName")) = "{Windows username who is a superuser}" And ActivePresentation.SlideShowSettings.ShowType <> ppShowTypeSpeaker Then  'this will check to be sure that we have not already changed the ShowType (which will have changed if the user opts to switch modes and the PPTX has re-started)
    'superuser, so, change to Speaker mode
    If MsgBox("Do you want to switch to Speaker view instead of Kiosk view so you can use PageDown?", vbYesNo + vbDefaultButton1, "Use PageDown?") = vbYes Then
        ActivePresentation.SlideShowSettings.ShowType = ppShowTypeSpeaker  'switch from Kiosk to Speaker mode so that PageDown key will work
        ActivePresentation.SlideShowSettings.AdvanceMode = ppSlideShowManualAdvance  'switch to allow PageDown to manually advance the slides
        ActivePresentation.SlideShowWindow.View.Exit  'exit the show because the change in play mode and advance mode will not take effect until the show is started again
        ActivePresentation.SlideShowSettings.Run    'restart the show; code in the OnSlideShowPageChange will get triggered to skip this first slide if the user has restarted the show
        Exit Sub
    End If
End If
ActivePresentation.SlideShowWindow.View.Next  'move to next slide
End Sub

Then, to prevent the superuser from having to view the first slide twice when the slideshow re-starts, I have added the following code to the OnSlideShowPageChange event:

SlideName = ActivePresentation.SlideShowWindow.View.Slide.Name
If SlideName = "sldTitle" Then    'we're on the first slide
    If ActivePresentation.SlideShowSettings.ShowType = ppShowTypeSpeaker Then  'this will be true if the Windows user is me (see code in Slide1), and, since I've already seen that slide, just go to the next slide
        ActivePresentation.SlideShowWindow.View.Next  'skip the first slide for superuser
        'execute other code as desired
        'use Exit Sub here if the code below does not need to run for the superuser
    End If
End If

'execute other code as desired here, e.g., code for standard users

For me, Slide 1 gives a lengthy delay (maybe 10 seconds) after clicking the [OK] button before the slideshow re-starts, but, the standard user does not experience the delay so I don't mind the wait--it probably has something to do with the VBA code and large number of slides in the presentation that have numerous ActiveX controls--at least, that's my guess.

Hope this helps someone out!