Consulting

Results 1 to 9 of 9

Thread: Non-click, non-mouse originated trigger?

  1. #1

    Non-click, non-mouse originated trigger?

    Hi all,

    I have found certain triggers which can be used in PP coding, such as onclick() or onMouseover().

    are there any functions such as 'onload()', or 'onSlideactive()' or something like that? I wish to add coding to a slide which will happen once the slide activates, not having to have user input,

    thanks

    rainer

  2. #2
    VBAX Mentor Brandtrock's Avatar
    Joined
    Jun 2004
    Location
    Titonka, IA
    Posts
    399
    Location
    PowerPoint events are a bit different than Excel or Word events. They get declared in a Class module as follows from the Help files

    Using Events with the Application Object

    See Also Specifics
    To create an event handler for an event of the Application object, you need to complete the following three steps:
    1. Declare an object variable in a class module to respond to the events.
    2. Write the specific event procedures.
    3. Initialize the declared object from another module.
    Declare the Object Variable

    Before you can write procedures for the events of the Application object, you must create a new class module and declare an object of type Application with events. For example, assume that a new class module is created and called EventClassModule. The new class module contains the following code.
    Public WithEvents App As Application
    Write the Event Procedures

    After the new object has been declared with events, it appears in the Object list in the class module, and you can write event procedures for the new object. (When you select the new object in the Object list, the valid events for that object are listed in the Procedure list.) Select an event from the Procedure list; an empty procedure is added to the class module.
    [VBA] Private Sub App_NewPresentation()

    End Sub
    [/VBA] Initializing the Declared Object

    Before the procedure will run, you must connect the declared object in the class module (App in this example) with the Application object. You can do this with the following code from any module.[VBA]
    Dim X As New EventClassModule
    Sub InitializeApp()
    Set X.App = Application
    End Sub[/VBA]
    Run the InitializeApp procedure. After the procedure is run, the App object in the class module points to the Microsoft PowerPoint Application object, and the event procedures in the class module will run when the events occur


    The list below is from the drop down once the class module is created.
    The following events are available:

    AfterNewPresentation(ByVal Pres As Presentation)
    AfterPresentationOpen(ByVal Pres As Presentation)
    ColorSchemeChanged(ByVal SldRange As SlideRange)
    NewPresentation(ByVal Pres As Presentation)
    PresentationBeforeSave(ByVal Pres As Presentation, Cancel As Boolean)
    PresentationClose(ByVal Pres As Presentation)
    PresentationNewSlide(ByVal Sld As Slide)
    PresentationOpen(ByVal Pres As Presentation)
    PresentationPrint(ByVal Pres As Presentation)
    PresentationSave(ByVal Pres As Presentation
    PresentationSync(ByVal Pres As Presentation, ByVal SyncEventType As Office.MsoSyncEventType)
    SlideSelectionChanged(ByVal SldRange As SlideRange)
    SlideShowBegin(ByVal Wn As SlideShowWindow)
    SlideShowEnd(ByVal Pres As Presentation)
    SlideShowNextBuild(ByVal Wn As SlideShowWindow)
    SlideShowNextClick(ByVal Wn As SlideShowWindow, ByVal nEffect As Effect)
    SlideShowNextSlide(ByVal Wn As SlideShowWindow)
    WindowActivate(ByVal Pres As Presentation, ByVal Wn As DocumentWindow)
    WindowBeforeDoubleClick(ByVal Sel As Selection, Cancel As Boolean)
    WindowBeforeRightClick(ByVal Sel As Selection, Cancel As Boolean)
    WindowDeactivate(ByVal Pres As Presentation, ByVal Wn As DocumentWindow)
    WindowSelectionChange(ByVal Sel As Selection)


    I'm not as familiar with PowerPoint as I am with Excel, so we may be learning as we go here, but I hope this gives you a start.

    Regards,
    Brandtrock




  3. #3
    Look in the help files for SlideShowNextSlide Event

    ___________________________________
    g-
    gwkenny@Fin-ITSolutions.com
    ___________________________________

  4. #4
    VBAX Master
    Joined
    Feb 2007
    Posts
    2,094
    Location
    While the above is the best way to go PowerPoint can react to the new slide in a slide show using

    [vba]Sub OnSlideShowPageChange()
    'Do something
    End Sub[/vba]It is a little flaky though and you may need to call it manually once and then it should fire with every new slide.
    John Wilson
    Microsoft PowerPoint MVP
    Amazing Free PowerPoint Tutorials
    http://www.pptalchemy.co.uk/powerpoi...tutorials.html

  5. #5

    Thank you and small additional questions

    Thank you both very much for the information!!!

    Two minor questions:
    When one declares the class/ procedure - does this have to happen on each computer on which the specific power point presentation is run, or is the 'initialization' process coded into the PPT/ PPS itself?

    Also, the function 'OnSlideShowPageChange()': Where can I place this function (I apologize if these are ignorant questions, but I have tried several functions which did not react)? Is it feasible to open Microsoft Script editor and inserting the function in the <Head> portion?

    Again, thank you - this is helping immensely!

  6. #6
    VBAX Master
    Joined
    Feb 2007
    Posts
    2,094
    Location
    Have a look in the kbase on this site. Search for PowerPoint applications and there are examples of both these techniques. If you use the OnSlideShowPageChange idea I would have an action button on slide one that the user presses to start the show. Give it an action of Run Macro. Once the macro has run once it will fire with every new page.
    John Wilson
    Microsoft PowerPoint MVP
    Amazing Free PowerPoint Tutorials
    http://www.pptalchemy.co.uk/powerpoi...tutorials.html

  7. #7
    I'm VERY new to VB and the descriptions you all gave are over my head. Can anyone simplify them for me?

    Rob

  8. #8

    Thumbs up You're the best!

    Thank you very much!

    Rainer

  9. #9
    This is really a good place to study. Thanks for all!

Posting Permissions

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