Results 1 to 3 of 3
  1. #1
    Join Date
    Feb 2005

    Unanswered: Any VBA for Powerpoint experts out there?

    I know that this is not an Access question but someone here can probaly answer this VBA question. When you run a slide show in PP you can change slides by pressing the enter key. However, I have two command buttons on the first slide and I want to force the user to use one of these buttons to navigate the show. How can I disable the keyboard interaction in VBA or ????

  2. #2
    Join Date
    Apr 2004
    outside the rim
    Not my area of competence, but a quick look and I came up with an idea or two:

    1) Make your first slide a seperate slide show set to loop continuously (in the Set Up Show menu) and use code similar to the following to launch the second slide show (the rest of your show) in your command buttons:
    With ActivePresentation.SlideShowSettings
        .RangeType = ppShowNamedSlideShow
        .SlideShowName = "Other Show"
    End With
    2) Try to setup the Class module to utilize the Slide events.
    In the Code Window for VBA, open help and lookup "Using Events with the Application Object" this gets you in the game. It tells you how to setup a Class module and initialize it for Application objects and events.

    I fiddled around briefly by inserting a blank slide as the second slide and included the following code in the Class module:
    Option Explicit
    Public WithEvents App As Application
    Private Sub App_SlideShowNextSlide(ByVal Wn As SlideShowWindow)
        Dim iC As Integer
        iC = Wn.View.CurrentShowPosition
        If iC = 2 Then SlideShowWindows(1).View.GotoSlide 1
    End Sub
    Unlike the example, I called my class object Class1

    Then, I put a couple command buttons on slide 1 and inserted the following code behind slide 1:
    Option Explicit
    Dim X As New Class1
    Sub InitializeApp()
        Set X.App = Application
    End Sub
    Private Sub cmdAdvance_Click()
        SlideShowWindows(1).View.GotoSlide 3
    End Sub
    Private Sub cmdInitialize_Click()
        Call InitializeApp
    End Sub
    It's crude, but it works and you may well find a way to improve upon it. When Enter is pressed, slide 2 is called and the before change is triggered. The event changes the show back to slide 1. It's causes a flicker on the screen, probably because my slide 2 was blank but slide 1 was not. Perhaps if slide 2 is identical in layout to slide 1, the flicker is less.

    A more ideal solution is to cancel the slide change event, but I didn't see that option in my brief glance through the help system.

    I got all this from the help system, by the way, so you should consider that as a good source as well.


  3. #3
    Join Date
    Feb 2005
    Thanks for all your effort. I bumbled through the help files for awhile but if you don't query with the right key word you can go in circles.
    A more ideal solution is to cancel the slide change event
    This was my first thought and as you discovered there is no cancel event (at least that I can find). I'll give your other ideas a try.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts